commit 677b2edd51317b214acacc1dee411765b0e7141a parent 39a2445d7486a9a571b0d9c90f593047954f94a1 Author: Dan Stillman <dstillman@zotero.org> Date: Fri, 20 Oct 2017 17:42:11 -0400 Throw a proper error if item.relations isn't an object Diffstat:
| M | chrome/content/zotero/xpcom/data/dataObject.js | | | 4 | ++++ |
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git 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