Not sure how this bug made it this far, but don't return empty values in Items.get() when passed an array including nonexistent itemIDs

This commit is contained in:
Dan Stillman 2007-01-09 05:49:31 +00:00
parent 97665e4060
commit c33cc7d0c9

View File

@ -2224,13 +2224,18 @@ Zotero.Items = new function(){
// If single id, return the object directly
if (arguments[0] && typeof arguments[0]!='object'
&& typeof arguments[1]=='undefined'){
if (!_items[arguments[0]]) {
Zotero.debug("Item " + arguments[0] + " doesn't exist", 2);
return false;
}
return _items[arguments[0]];
}
// Otherwise, build return array
for (i=0; i<ids.length; i++){
if (!_items[ids[i]]){
Zotero.debug("Item " + ids[i] + " not loaded -- this shouldn't happen", 2);
Zotero.debug("Item " + ids[i] + " doesn't exist", 2);
continue;
}
loaded.push(_items[ids[i]]);
}