Properly handle cases where no translator is specified
This commit is contained in:
parent
f24091626d
commit
1d1b825c62
1 changed files with 3 additions and 1 deletions
|
@ -1046,6 +1046,7 @@ Zotero.Translate.Base.prototype = {
|
||||||
|
|
||||||
if(!this.translator || !this.translator.length) {
|
if(!this.translator || !this.translator.length) {
|
||||||
this.complete(false, new Error("No translator specified"));
|
this.complete(false, new Error("No translator specified"));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._libraryID = libraryID;
|
this._libraryID = libraryID;
|
||||||
|
@ -2092,7 +2093,8 @@ Zotero.Translate.Search.prototype.setTranslator = function(translator) {
|
||||||
* translation fails
|
* translation fails
|
||||||
*/
|
*/
|
||||||
Zotero.Translate.Search.prototype.complete = function(returnValue, error) {
|
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);
|
Zotero.debug("Translate: Could not find a result using "+this.translator[0].label, 3);
|
||||||
if(error) Zotero.debug(this._generateErrorString(error), 3);
|
if(error) Zotero.debug(this._generateErrorString(error), 3);
|
||||||
if(this.translator.length > 1) {
|
if(this.translator.length > 1) {
|
||||||
|
|
Loading…
Reference in a new issue