Fix document preferences dialog failing when styles unloaded.

Closes #1084
This commit is contained in:
Adomas Venčkauskas 2017-03-21 12:47:32 +02:00
parent 64414e49be
commit d5cf33a798
2 changed files with 5 additions and 3 deletions

View file

@ -45,7 +45,7 @@ var Zotero_File_Interface_Bibliography = new function() {
* Initialize some variables and prepare event listeners for when chrome is done
* loading
*/
this.init = function () {
this.init = Zotero.Promise.coroutine(function* () {
// Set font size from pref
// Affects bibliography.xul and integrationDocPrefs.xul
var bibContainer = document.getElementById("zotero-bibliography-container");
@ -68,6 +68,8 @@ var Zotero_File_Interface_Bibliography = new function() {
}
// add styles to list
yield Zotero.Styles.init();
var styles = Zotero.Styles.getVisible();
var index = 0;
var nStyles = styles.length;
@ -171,7 +173,7 @@ var Zotero_File_Interface_Bibliography = new function() {
// set style to false, in case this is cancelled
_io.style = false;
};
});
/*
* Called when locale is changed

View file

@ -49,7 +49,6 @@ Zotero.Styles = new function() {
this.reinit = Zotero.Promise.coroutine(function* () {
Zotero.debug("Initializing styles");
var start = new Date;
_initialized = true;
// Upgrade style locale prefs for 4.0.27
var bibliographyLocale = Zotero.Prefs.get("export.bibliographyLocale");
@ -114,6 +113,7 @@ Zotero.Styles = new function() {
_renamedStyles = xmlhttp.response;
}
})
_initialized = true;
});
this.init = Zotero.lazy(this.reinit);