From 46e3e7293e9e38ed57333081b34e78bf1a5056c2 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 4 Feb 2013 05:03:12 -0500 Subject: [PATCH] Fix "results.sort is not a function" in tags autocomplete This occured if there were no autocomplete results for an entered tag string. --- components/zotero-autocomplete.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/zotero-autocomplete.js b/components/zotero-autocomplete.js index 4639b7ef4..f1b11eaba 100644 --- a/components/zotero-autocomplete.js +++ b/components/zotero-autocomplete.js @@ -88,6 +88,9 @@ ZoteroAutoComplete.prototype.startSearch = function(searchString, searchParam, p statement = this._zotero.DB.getStatement(sql, sqlParams); var resultsCallback = function (results) { + if (!results) { + return; + } var collation = self._zotero.getLocaleCollation(); results.sort(function(a, b) { return collation.compareString(1, a.val, b.val);