Throw if invalid object id passed to Zotero.DataObjects::getAsync()

This commit is contained in:
Dan Stillman 2016-12-14 02:02:35 -05:00
parent 8a4c8d2be0
commit 58f554a930

View file

@ -177,6 +177,9 @@ Zotero.DataObjects.prototype.getAsync = Zotero.Promise.coroutine(function* (ids,
toReturn.push(this._objectCache[id]);
}
else {
if (!ids.every(id => Number.isInteger(id))) {
throw new Error(`Invalid ${this._ZDO_object} ID '${id}'`);
}
toLoad.push(id);
}
}