From 176e2f2d0516f5fc65012b4be26bed4b18511808 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Mon, 8 Aug 2011 22:27:50 +0000 Subject: [PATCH] Don't throw an error on CSL_BIBLIOGRAPHY codes --- chrome/content/zotero/xpcom/integration.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 8dcf53d79b..06954a0a6f 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -1756,8 +1756,11 @@ Zotero.Integration.Session.prototype.restoreProcessorState = function() { * Loads document data from a JSON object */ Zotero.Integration.Session.prototype.loadBibliographyData = function(json) { + var openBraceIndex = json.indexOf("{"); + if(openBraceIndex == -1) return; + try { - var documentData = JSON.parse(json.substring(json.indexOf("{"), json.lastIndexOf("}")+1)); + var documentData = JSON.parse(json.substring(openBraceIndex, json.lastIndexOf("}")+1)); } catch(e) { try { var documentData = JSON.parse(json.substr(0, json.length-1));