diff options
author | webzwo0i <webzwo0i@c3d2.de> | 2015-02-16 09:01:30 +0100 |
---|---|---|
committer | webzwo0i <webzwo0i@c3d2.de> | 2015-02-16 09:01:30 +0100 |
commit | 37924e441a3c0432088d3c33f544c8c7cefc92eb (patch) | |
tree | c1d5b20caaa9c16aab3a8be0dabefbdad2a1c90d /src/node | |
parent | c9a5167b41f2a5b247a0a59cd42dd77f29123e71 (diff) | |
download | etherpad-lite-37924e441a3c0432088d3c33f544c8c7cefc92eb.zip |
add try-catch clause around calls to applyToAText
Diffstat (limited to 'src/node')
-rw-r--r-- | src/node/utils/padDiff.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/node/utils/padDiff.js b/src/node/utils/padDiff.js index 88fa5cba..24d5bb0c 100644 --- a/src/node/utils/padDiff.js +++ b/src/node/utils/padDiff.js @@ -101,8 +101,12 @@ PadDiff.prototype._createClearStartAtext = function(rev, callback){ return callback(err); } + try { //apply the clearAuthorship changeset var newAText = Changeset.applyToAText(changeset, atext, self._pad.pool); + } catch(err) { + return callback(err) + } callback(null, newAText); }); @@ -209,10 +213,14 @@ PadDiff.prototype._createDiffAtext = function(callback) { if(superChangeset){ var deletionChangeset = self._createDeletionChangeset(superChangeset,atext,self._pad.pool); - //apply the superChangeset, which includes all addings - atext = Changeset.applyToAText(superChangeset,atext,self._pad.pool); - //apply the deletionChangeset, which adds a deletions - atext = Changeset.applyToAText(deletionChangeset,atext,self._pad.pool); + try { + //apply the superChangeset, which includes all addings + atext = Changeset.applyToAText(superChangeset,atext,self._pad.pool); + //apply the deletionChangeset, which adds a deletions + atext = Changeset.applyToAText(deletionChangeset,atext,self._pad.pool); + } catch(err) { + return callback(err) + } } callback(err, atext); |