Merge pull request #2831 from fcassin/develop
Protect against a null atext value in cloneATextpull/2851/head
commit
f44c444720
|
@ -188,7 +188,12 @@ Pad.prototype.getInternalRevisionAText = function getInternalRevisionAText(targe
|
||||||
db.getSub("pad:"+_this.id+":revs:"+keyRev, ["meta", "atext"], function(err, _atext)
|
db.getSub("pad:"+_this.id+":revs:"+keyRev, ["meta", "atext"], function(err, _atext)
|
||||||
{
|
{
|
||||||
if(ERR(err, callback)) return;
|
if(ERR(err, callback)) return;
|
||||||
|
try {
|
||||||
atext = Changeset.cloneAText(_atext);
|
atext = Changeset.cloneAText(_atext);
|
||||||
|
} catch (e) {
|
||||||
|
return callback(e);
|
||||||
|
}
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1628,10 +1628,12 @@ exports.applyToAText = function (cs, atext, pool) {
|
||||||
* @param atext {AText}
|
* @param atext {AText}
|
||||||
*/
|
*/
|
||||||
exports.cloneAText = function (atext) {
|
exports.cloneAText = function (atext) {
|
||||||
|
if (atext) {
|
||||||
return {
|
return {
|
||||||
text: atext.text,
|
text: atext.text,
|
||||||
attribs: atext.attribs
|
attribs: atext.attribs
|
||||||
};
|
}
|
||||||
|
} else exports.error("atext is null");
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue