Fix removal of creators when changing to item type without creators

This shouldn't actually be used currently, since only notes and
attachments lack creators and it shouldn't be possible to change regular
items into notes or attachments.
This commit is contained in:
Dan Stillman 2020-03-17 12:01:34 -04:00
parent c4aad9a041
commit 3247391914

View file

@ -499,10 +499,11 @@ Zotero.Item.prototype.setType = function(itemTypeID, loadIn) {
let creators = this.getCreators(); let creators = this.getCreators();
if (creators.length) { if (creators.length) {
let removeAll = !Zotero.CreatorTypes.itemTypeHasCreators(itemTypeID); let removeAll = !Zotero.CreatorTypes.itemTypeHasCreators(itemTypeID);
for (let i=0; i<creators.length; i++) { for (let i = 0; i < this.getCreators().length; i++) {
// Remove all creators if new item type doesn't have any // Remove all creators if new item type doesn't have any
if (removeAll) { if (removeAll) {
this.removeCreator(i); this.removeCreator(i);
i--;
continue; continue;
} }