www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 0aaa0540d978e96a698b71c8a7067633b696b00c
parent cd358977f3a0352c3a82f2c5686ece1e027710de
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon,  9 Mar 2015 19:11:36 -0400

Delete syncedSettings for deleted libraries on sync error

Not sure how this is possible, but fix it for now. It'll be prevented with a FK
check in 5.0.

Diffstat:
Mchrome/content/zotero/xpcom/sync.js | 14+++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js @@ -2107,7 +2107,19 @@ Zotero.Sync.Server = new function () { var background = Zotero.Sync.Runner.background; setTimeout(function () { var libraryID = parseInt(firstChild.getAttribute('libraryID')); - var group = Zotero.Groups.getByLibraryID(libraryID); + + try { + var group = Zotero.Groups.getByLibraryID(libraryID); + } + catch (e) { + // Not sure how this is possible, but it's affecting some people + // TODO: Clean up in schema updates with FK check + if (!Zotero.Libraries.exists(libraryID)) { + let sql = "DELETE FROM syncedSettings WHERE libraryID=?"; + Zotero.DB.query(sql, libraryID); + return; + } + } var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] .getService(Components.interfaces.nsIPromptService);