diff options
author | Francois Cassin <francois.cassin@kosmos.fr> | 2015-11-10 16:21:43 +0100 |
---|---|---|
committer | Francois Cassin <francois.cassin@kosmos.fr> | 2015-11-10 16:21:43 +0100 |
commit | 2bd698343a586f627e8b577da2e190d37592e77a (patch) | |
tree | 0481c453fc29e3f1a952ada697529b863345bc93 /src | |
parent | f2836125dc887bf02c1c42231b670d4493a7f2ab (diff) | |
download | etherpad-lite-2bd698343a586f627e8b577da2e190d37592e77a.zip |
Protects against a null atext in cloneAText
Diffstat (limited to 'src')
-rw-r--r-- | src/node/db/Pad.js | 7 | ||||
-rw-r--r-- | src/static/js/Changeset.js | 10 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index 83e15e6d..5d26f470 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -188,7 +188,12 @@ Pad.prototype.getInternalRevisionAText = function getInternalRevisionAText(targe db.getSub("pad:"+_this.id+":revs:"+keyRev, ["meta", "atext"], function(err, _atext) { if(ERR(err, callback)) return; - atext = Changeset.cloneAText(_atext); + try { + atext = Changeset.cloneAText(_atext); + } catch (e) { + return callback(e); + } + callback(); }); }, diff --git a/src/static/js/Changeset.js b/src/static/js/Changeset.js index 04a05514..6f6e7d09 100644 --- a/src/static/js/Changeset.js +++ b/src/static/js/Changeset.js @@ -1628,10 +1628,12 @@ exports.applyToAText = function (cs, atext, pool) { * @param atext {AText} */ exports.cloneAText = function (atext) { - return { - text: atext.text, - attribs: atext.attribs - }; + if (atext) { + return { + text: atext.text, + attribs: atext.attribs + } + } else exports.error("atext is null"); }; /** |