commit 1d1b825c629716e15838054caad4e52a35084e1f
parent f24091626d20de660344a327113a158b2cf33699
Author: aurimasv <aurimas.dev@gmail.com>
Date: Sat, 19 Jan 2013 01:50:47 -0600
Properly handle cases where no translator is specified
Diffstat:
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
@@ -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) {