From 79733c75f1f696aae448bac8d2e4ae0058203f24 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 16 Jun 2015 20:35:31 -0400 Subject: [PATCH] Throw error in Item::fromJSON() if itemType not provided and not set --- chrome/content/zotero/xpcom/data/item.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index 485c4c4fc3..bb42eb72e5 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -3802,6 +3802,10 @@ Zotero.Item.prototype.fromJSON = Zotero.Promise.coroutine(function* (json) { yield this.loadAllData(); } + if (!json.itemType && !this._itemTypeID) { + throw new Error("itemType property not provided"); + } + let itemTypeID = Zotero.ItemTypes.getID(json.itemType); this.setType(itemTypeID);