Don't leave document corrupted if error in doc prefs window

And recover by showing the doc prefs window if it is corrupted (at least
with an empty fieldType, which is what was happening previously)
This commit is contained in:
Dan Stillman 2017-01-04 01:39:04 -05:00
parent 4ff5323acd
commit 42a72fe8aa

View file

@ -939,7 +939,8 @@ Zotero.Integration.Document.prototype._getSession = function _getSession(require
} catch(e) {};
}
if(!data) {
// If no data or corrupted data, show doc prefs window again
if (!data || !data.prefs || !data.prefs.fieldType) {
var haveFields = false;
data = new Zotero.Integration.DocumentData();
@ -2121,7 +2122,7 @@ Zotero.Integration.Session.prototype.setDocPrefs = function(doc, primaryFieldTyp
return Zotero.Integration.displayDialog(doc,
'chrome://zotero/content/integration/integrationDocPrefs.xul', '', io)
.then(function() {
if(!io.style) {
if (!io.style || !io.fieldType) {
throw new Zotero.Exception.UserCancelled("document preferences window");
}