Don't unload object on save error if not new

This commit is contained in:
Dan Stillman 2017-02-02 22:34:12 -05:00
parent 79a07cad9e
commit 76bc61e882

View file

@ -909,6 +909,7 @@ Zotero.DataObject.prototype._initSave = Zotero.Promise.coroutine(function* (env)
} }
// Undo registerObject() on failure // Undo registerObject() on failure
if (env.isNew) {
var func = function () { var func = function () {
this.ObjectsClass.unload(this._id); this.ObjectsClass.unload(this._id);
}.bind(this); }.bind(this);
@ -918,6 +919,7 @@ Zotero.DataObject.prototype._initSave = Zotero.Promise.coroutine(function* (env)
else { else {
Zotero.DB.addCurrentCallback("rollback", func); Zotero.DB.addCurrentCallback("rollback", func);
} }
}
env.relationsToRegister = []; env.relationsToRegister = [];
env.relationsToUnregister = []; env.relationsToUnregister = [];