mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
add try-catch clause around calls to applyToAText
This commit is contained in:
parent
c9a5167b41
commit
37924e441a
1 changed files with 12 additions and 4 deletions
|
@ -101,8 +101,12 @@ PadDiff.prototype._createClearStartAtext = function(rev, callback){
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
//apply the clearAuthorship changeset
|
//apply the clearAuthorship changeset
|
||||||
var newAText = Changeset.applyToAText(changeset, atext, self._pad.pool);
|
var newAText = Changeset.applyToAText(changeset, atext, self._pad.pool);
|
||||||
|
} catch(err) {
|
||||||
|
return callback(err)
|
||||||
|
}
|
||||||
|
|
||||||
callback(null, newAText);
|
callback(null, newAText);
|
||||||
});
|
});
|
||||||
|
@ -209,10 +213,14 @@ PadDiff.prototype._createDiffAtext = function(callback) {
|
||||||
if(superChangeset){
|
if(superChangeset){
|
||||||
var deletionChangeset = self._createDeletionChangeset(superChangeset,atext,self._pad.pool);
|
var deletionChangeset = self._createDeletionChangeset(superChangeset,atext,self._pad.pool);
|
||||||
|
|
||||||
|
try {
|
||||||
//apply the superChangeset, which includes all addings
|
//apply the superChangeset, which includes all addings
|
||||||
atext = Changeset.applyToAText(superChangeset,atext,self._pad.pool);
|
atext = Changeset.applyToAText(superChangeset,atext,self._pad.pool);
|
||||||
//apply the deletionChangeset, which adds a deletions
|
//apply the deletionChangeset, which adds a deletions
|
||||||
atext = Changeset.applyToAText(deletionChangeset,atext,self._pad.pool);
|
atext = Changeset.applyToAText(deletionChangeset,atext,self._pad.pool);
|
||||||
|
} catch(err) {
|
||||||
|
return callback(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(err, atext);
|
callback(err, atext);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue