From 677b2edd51317b214acacc1dee411765b0e7141a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 20 Oct 2017 17:42:11 -0400 Subject: [PATCH] Throw a proper error if item.relations isn't an object --- chrome/content/zotero/xpcom/data/dataObject.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js index 78db5c3aa0..e5efe1dfb7 100644 --- a/chrome/content/zotero/xpcom/data/dataObject.js +++ b/chrome/content/zotero/xpcom/data/dataObject.js @@ -402,6 +402,10 @@ Zotero.DataObject.prototype.removeRelation = function (predicate, object) { Zotero.DataObject.prototype.setRelations = function (newRelations) { this._requireData('relations'); + if (typeof newRelations != 'object') { + throw new Error(`Relations must be an object (${typeof newRelations} given)`); + } + var oldRelations = this._relations; // Limit predicates to letters and colons for now