From 62a0bdf1e3c1eb8a1fceac3403bdc1afc6a041b0 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 8 May 2011 17:00:19 +0000 Subject: [PATCH] Don't break all styles on invalid XML --- chrome/content/zotero/xpcom/style.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/style.js b/chrome/content/zotero/xpcom/style.js index 1aaa207f6..9dae9c41b 100644 --- a/chrome/content/zotero/xpcom/style.js +++ b/chrome/content/zotero/xpcom/style.js @@ -71,7 +71,19 @@ Zotero.Styles = new function() { var file = contents.getNext().QueryInterface(Components.interfaces.nsIFile); if(!file.leafName || file.leafName[0] == "." || file.isDirectory()) continue; - var style = new Zotero.Style(file); + try { + var style = new Zotero.Style(file); + } + catch (e) { + Zotero.log( + "Error loading style '" + file.leafName + "': " + e.message, + "error", + file.path, + null, + e.lineNumber + ); + continue; + } if(style.styleID) { if(_styles[style.styleID]) { // same style is already cached