fx-compat: Style Editor: Fix error when no style selected

This commit is contained in:
Abe Jellinek 2022-09-12 14:06:58 -07:00
parent 52e8fa8995
commit 7829a0dfdc

View file

@ -148,7 +148,8 @@ var Zotero_CSL_Editor = new function() {
this.onStyleModified = function () {
let xml = editor.getValue();
let cslList = document.getElementById('zotero-csl-list');
if (xml !== Zotero.Styles.get(cslList.value)?.getXML()) {
let savedStyle = Zotero.Styles.get(cslList.value);
if (!savedStyle || xml !== savedStyle?.getXML()) {
cslList.selectedIndex = -1;
}