diff --git a/chrome/content/zotero/xpcom/data_access.js b/chrome/content/zotero/xpcom/data_access.js index ba9b70ea1..c0130bdf4 100644 --- a/chrome/content/zotero/xpcom/data_access.js +++ b/chrome/content/zotero/xpcom/data_access.js @@ -1188,8 +1188,12 @@ Zotero.Item.prototype.getNotes = function(){ * Return true if a note item is an abstract, false otherwise */ Zotero.Item.prototype.isAbstract = function() { + if (this.isAttachment()) { + return false; + } + if (!this.isNote()) { - throw ("getAbstract() can only be called on note items"); + throw ("isAbstract() can only be called on note items"); } if (!this.getID()) { diff --git a/chrome/content/zotero/xpcom/itemTreeView.js b/chrome/content/zotero/xpcom/itemTreeView.js index fed142be0..66ae78ce0 100644 --- a/chrome/content/zotero/xpcom/itemTreeView.js +++ b/chrome/content/zotero/xpcom/itemTreeView.js @@ -691,8 +691,8 @@ Zotero.ItemTreeView.prototype.setFilter = function(type, data) { this.sort(); this.rememberOpenState(savedOpenState); - this.rememberSelection(savedSelection); this.rememberFirstRow(savedFirstRow); + this.rememberSelection(savedSelection); this.selection.selectEventsSuppressed = false; this._treebox.invalidate(); //Zotero.debug('Running callbacks in itemTreeView.setFilter()', 4); @@ -818,12 +818,16 @@ Zotero.ItemTreeView.prototype.rememberOpenState = function(ids) { Zotero.ItemTreeView.prototype.saveFirstRow = function() { - return this._getItemAtRow(this._treebox.getFirstVisibleRow()).ref.getID(); + var row = this._treebox.getFirstVisibleRow(); + if (row) { + return this._getItemAtRow(row).ref.getID(); + } + return false; } Zotero.ItemTreeView.prototype.rememberFirstRow = function(firstRow) { - if (this._itemRowMap[firstRow]) { + if (firstRow && this._itemRowMap[firstRow]) { this._treebox.scrollToRow(this._itemRowMap[firstRow]); } }