From a76493f60dd41dacf1adefb06c807c18d2c387ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Tue, 2 May 2017 14:44:45 +0300 Subject: [PATCH] Fix noteType type issues when talking to js-ctypes libs Reported https://forums.zotero.org/discussion/65496/zotero-5-185-bug-cant-insert-field --- chrome/content/zotero/xpcom/integration.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 597ee4a8a..9ab746ba0 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -3141,12 +3141,17 @@ Zotero.Integration.DocumentData.prototype.unserializeXML = function(xmlData) { this.prefs[name] = value; } - if(this.prefs["storeReferences"] === undefined) this.prefs["storeReferences"] = false; - if(this.prefs["automaticJournalAbbreviations"] === undefined) this.prefs["automaticJournalAbbreviations"] = false; + try { + this.prefs.noteType = parseInt(noteType); + } catch (e) { + this.prefs.noteType = 0; + } + if (this.prefs["storeReferences"] === undefined) this.prefs["storeReferences"] = false; + if (this.prefs["automaticJournalAbbreviations"] === undefined) this.prefs["automaticJournalAbbreviations"] = false; this.zoteroVersion = doc.documentElement.getAttribute("zotero-version"); - if(!this.zoteroVersion) this.zoteroVersion = "2.0"; + if (!this.zoteroVersion) this.zoteroVersion = "2.0"; this.dataVersion = doc.documentElement.getAttribute("data-version"); - if(!this.dataVersion) this.dataVersion = 2; + if (!this.dataVersion) this.dataVersion = 2; }; /**