Throw a proper error if item.relations isn't an object

This commit is contained in:
Dan Stillman 2017-10-20 17:42:11 -04:00
parent 39a2445d74
commit 677b2edd51

View file

@ -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