1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-07 22:33:50 +00:00

Fix occasional crash from trying to save a tiddler after it has been deleted

This commit is contained in:
Jermolene 2013-12-12 15:16:44 +00:00
parent 6a21965cee
commit 49b3165fbd

View File

@ -437,19 +437,21 @@ Syncer.prototype.dispatchTask = function(task,callback) {
var changeCount = this.wiki.getChangeCount(task.title), var changeCount = this.wiki.getChangeCount(task.title),
tiddler = this.wiki.getTiddler(task.title); tiddler = this.wiki.getTiddler(task.title);
this.log("Dispatching 'save' task:",task.title); this.log("Dispatching 'save' task:",task.title);
this.syncadaptor.saveTiddler(tiddler,function(err,adaptorInfo,revision) { if(tiddler) {
if(err) { this.syncadaptor.saveTiddler(tiddler,function(err,adaptorInfo,revision) {
return callback(err); if(err) {
} return callback(err);
// Adjust the info stored about this tiddler }
self.tiddlerInfo[task.title] = { // Adjust the info stored about this tiddler
changeCount: changeCount, self.tiddlerInfo[task.title] = {
adaptorInfo: adaptorInfo, changeCount: changeCount,
revision: revision adaptorInfo: adaptorInfo,
}; revision: revision
// Invoke the callback };
callback(null); // Invoke the callback
}); callback(null);
});
}
} else if(task.type === "load") { } else if(task.type === "load") {
// Load the tiddler // Load the tiddler
this.log("Dispatching 'load' task:",task.title); this.log("Dispatching 'load' task:",task.title);