From 7471c9dc739228a5a9b71867ba56ba44d2aa7f7d Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 3 Jun 2008 19:24:42 +0000 Subject: [PATCH] Fix error when loading a saved search with an empty 'is/isNot' text condition Fix 'null' appearing in saved search window when editing a search with an empty 'is/isNot' text condition --- chrome/content/zotero/bindings/zoterosearch.xml | 4 +++- chrome/content/zotero/xpcom/search.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/bindings/zoterosearch.xml b/chrome/content/zotero/bindings/zoterosearch.xml index dea7fc4f1..365654111 100644 --- a/chrome/content/zotero/bindings/zoterosearch.xml +++ b/chrome/content/zotero/bindings/zoterosearch.xml @@ -542,7 +542,9 @@ this.mode = condition['mode']; this.id('operatorsmenu').value = condition['operator']; - this.value = prefix + condition['value']; + this.value = prefix + + (condition.value ? condition.value : ''); + this.dontupdate = false; } diff --git a/chrome/content/zotero/xpcom/search.js b/chrome/content/zotero/xpcom/search.js index 39f46005a..51e101778 100644 --- a/chrome/content/zotero/xpcom/search.js +++ b/chrome/content/zotero/xpcom/search.js @@ -1142,7 +1142,8 @@ Zotero.Search.prototype._buildQuery = function(){ case 'isNot': // excluded with NOT IN above // Automatically cast values which might // have been stored as integers - if (condition.value.match(/^[1-9]+[0-9]*$/)) { + if (condition.value + && condition.value.match(/^[1-9]+[0-9]*$/)) { condSQL += ' LIKE ?'; } else {