Bad JSON in sync cache shouldn't break syncing

https://forums.zotero.org/discussion/95926/zotero-not-syncing-report-id-1924846177
This commit is contained in:
Dan Stillman 2022-04-19 17:46:52 -04:00
parent 5c8ea0174a
commit 3f10e4c064

View file

@ -667,7 +667,14 @@ Zotero.Sync.Data.Local = {
+ "syncObjectTypes WHERE name=?)";
var data = yield Zotero.DB.valueQueryAsync(sql, [libraryID, key, version, objectType]);
if (data) {
return JSON.parse(data);
try {
return JSON.parse(data);
}
// Shouldn't happen, but don't break syncing if it does
// https://forums.zotero.org/discussion/95926/zotero-not-syncing-report-id-1924846177
catch (e) {
Zotero.logError(e);
}
}
return false;
}),