Fix "New Zotero.Item objects shouldn't be accessed after save" warning during sync
This commit is contained in:
parent
fdcc02d953
commit
11f2810586
1 changed files with 5 additions and 6 deletions
|
@ -1834,16 +1834,15 @@ Zotero.Sync.Server.Data = new function() {
|
||||||
Zotero.debug('Saving merged ' + types);
|
Zotero.debug('Saving merged ' + types);
|
||||||
// Save parent items first
|
// Save parent items first
|
||||||
if (type == 'item') {
|
if (type == 'item') {
|
||||||
for each(var obj in toSave) {
|
for (var i=0; i<toSave.length; i++) {
|
||||||
if (!obj.getSource()) {
|
if (!toSave[i].getSource()) {
|
||||||
obj.save();
|
toSave[i].save();
|
||||||
|
toSave.splice(i, 1);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for each(var obj in toSave) {
|
for each(var obj in toSave) {
|
||||||
if (type == 'item' && !obj.getSource()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
obj.save();
|
obj.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue