From 1d1b825c629716e15838054caad4e52a35084e1f Mon Sep 17 00:00:00 2001 From: aurimasv Date: Sat, 19 Jan 2013 01:50:47 -0600 Subject: [PATCH] Properly handle cases where no translator is specified --- chrome/content/zotero/xpcom/translation/translate.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 2ae8355f9..af95601ff 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -1046,6 +1046,7 @@ Zotero.Translate.Base.prototype = { if(!this.translator || !this.translator.length) { this.complete(false, new Error("No translator specified")); + return; } this._libraryID = libraryID; @@ -2092,7 +2093,8 @@ Zotero.Translate.Search.prototype.setTranslator = function(translator) { * translation fails */ Zotero.Translate.Search.prototype.complete = function(returnValue, error) { - if(this._currentState == "translate" && (!this.newItems || !this.newItems.length)) { + if(this._currentState == "translate" && (!this.newItems || !this.newItems.length) + && this.translator.length) { //length is 0 only when translate was called without translators Zotero.debug("Translate: Could not find a result using "+this.translator[0].label, 3); if(error) Zotero.debug(this._generateErrorString(error), 3); if(this.translator.length > 1) {