From 3f10e4c064d0b01495367d37bfedccb0460514c5 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 19 Apr 2022 17:46:52 -0400 Subject: [PATCH] Bad JSON in sync cache shouldn't break syncing https://forums.zotero.org/discussion/95926/zotero-not-syncing-report-id-1924846177 --- chrome/content/zotero/xpcom/sync/syncLocal.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/sync/syncLocal.js b/chrome/content/zotero/xpcom/sync/syncLocal.js index 985f8cbf6a..43bfe27ba6 100644 --- a/chrome/content/zotero/xpcom/sync/syncLocal.js +++ b/chrome/content/zotero/xpcom/sync/syncLocal.js @@ -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; }),