Throw error if NULL libraryID is passed to DataObjects.getByLibraryAndKey()

This commit is contained in:
Dan Stillman 2014-09-09 02:10:04 -04:00
parent 755ead2119
commit 985a5db0da

View file

@ -275,6 +275,9 @@ Zotero.DataObjects = function (object, objectPlural, id, table) {
this.getIDFromLibraryAndKey = function (libraryID, key) {
if (libraryID === null) {
throw new Error("libraryID cannot be NULL (did you mean 0?)");
}
return (this._objectIDs[libraryID] && this._objectIDs[libraryID][key])
? this._objectIDs[libraryID][key] : false;
}