commit 79733c75f1f696aae448bac8d2e4ae0058203f24 parent e45aabd03cf216922db91bca2594a1a6ce79f3a1 Author: Dan Stillman <dstillman@zotero.org> Date: Tue, 16 Jun 2015 20:35:31 -0400 Throw error in Item::fromJSON() if itemType not provided and not set Diffstat:
| M | chrome/content/zotero/xpcom/data/item.js | | | 4 | ++++ |
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git 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);