Fix possible restart error with invalid Quick Copy setting
If you had Quick Copy set to a missing translator, had a site-specific Quick Copy setting, and loaded a page in the browser, the next click on an item would result in a restart error.
This commit is contained in:
parent
6112002003
commit
5ad2a83b61
2 changed files with 12 additions and 2 deletions
chrome/content/zotero
|
@ -161,7 +161,12 @@ const ZoteroStandalone = new function() {
|
|||
if (format.mode == 'export') {
|
||||
try {
|
||||
let obj = Zotero.Translators.get(format.id);
|
||||
copyExport.label = Zotero.getString('quickCopy.copyAs', obj.label);
|
||||
if (obj) {
|
||||
copyExport.label = Zotero.getString('quickCopy.copyAs', obj.label);
|
||||
}
|
||||
else {
|
||||
copyExport.hidden = true;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (!(e instanceof Zotero.Exception.UnloadedDataException && e.dataType == 'translators')) {
|
||||
|
|
|
@ -182,7 +182,8 @@ Zotero.QuickCopy = new function() {
|
|||
}
|
||||
|
||||
if (!_siteSettings) {
|
||||
throw new Zotero.Exception.UnloadedDataException("Quick Copy site settings not loaded");
|
||||
Zotero.debug("Quick Copy site settings not loaded", 2);
|
||||
return quickCopyPref;
|
||||
}
|
||||
|
||||
var matches = [];
|
||||
|
@ -461,6 +462,10 @@ Zotero.QuickCopy = new function() {
|
|||
Zotero.debug(`Preloading ${format.id} for Quick Copy`);
|
||||
await Zotero.Translators.init();
|
||||
let translator = Zotero.Translators.get(format.id);
|
||||
if (!translator) {
|
||||
Zotero.logError(`Translator ${format.id} not found`);
|
||||
return;
|
||||
}
|
||||
translator.cacheCode = true;
|
||||
await translator.getCode();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue