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:
parent
97665e4060
commit
c33cc7d0c9
|
@ -2224,13 +2224,18 @@ Zotero.Items = new function(){
|
||||||
// If single id, return the object directly
|
// If single id, return the object directly
|
||||||
if (arguments[0] && typeof arguments[0]!='object'
|
if (arguments[0] && typeof arguments[0]!='object'
|
||||||
&& typeof arguments[1]=='undefined'){
|
&& typeof arguments[1]=='undefined'){
|
||||||
|
if (!_items[arguments[0]]) {
|
||||||
|
Zotero.debug("Item " + arguments[0] + " doesn't exist", 2);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return _items[arguments[0]];
|
return _items[arguments[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, build return array
|
// Otherwise, build return array
|
||||||
for (i=0; i<ids.length; i++){
|
for (i=0; i<ids.length; i++){
|
||||||
if (!_items[ids[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]]);
|
loaded.push(_items[ids[i]]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user