Fix "New Zotero.Item objects shouldn't be accessed after save" warning during sync

This commit is contained in:
Dan Stillman 2008-11-10 09:42:57 +00:00
parent fdcc02d953
commit 11f2810586

View file

@ -1834,16 +1834,15 @@ Zotero.Sync.Server.Data = new function() {
Zotero.debug('Saving merged ' + types);
// Save parent items first
if (type == 'item') {
for each(var obj in toSave) {
if (!obj.getSource()) {
obj.save();
for (var i=0; i<toSave.length; i++) {
if (!toSave[i].getSource()) {
toSave[i].save();
toSave.splice(i, 1);
i--;
}
}
}
for each(var obj in toSave) {
if (type == 'item' && !obj.getSource()) {
continue;
}
obj.save();
}