From 962eb558a2a8cbeb5a2494616900269806f3d040 Mon Sep 17 00:00:00 2001
From: Lloyd Hilaiel <lloyd@hilaiel.com>
Date: Fri, 4 May 2012 18:53:01 -0600
Subject: [PATCH] fix errors emitted to console during tests.  closes #1547

---
 resources/static/shared/storage.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/resources/static/shared/storage.js b/resources/static/shared/storage.js
index aeed80dae..ecd0b7d40 100644
--- a/resources/static/shared/storage.js
+++ b/resources/static/shared/storage.js
@@ -407,7 +407,7 @@ BrowserID.Storage = (function() {
 
   function currentInteractionData() {
     try {
-      return JSON.parse(storage.interactionData)[0];
+      return storage.interactionData ? JSON.parse(storage.interactionData)[0] : {};
     } catch(e) {
       if (window.console && console.error) console.error(e);
       return {};
@@ -428,7 +428,7 @@ BrowserID.Storage = (function() {
 
   function getAllInteractionData() {
     try {
-      return JSON.parse(storage.interactionData);
+      return storage.interactionData ? JSON.parse(storage.interactionData) : [];
     } catch(e) {
       if (window.console && console.error) console.error(e);
       return [];
@@ -440,7 +440,7 @@ BrowserID.Storage = (function() {
       storage.interactionData = JSON.stringify([]);
     } catch(e) {
       delete storage.interactionData;
-      if (window.console && console.error) console.error(e);      
+      if (window.console && console.error) console.error(e);
     }
   }
 
-- 
GitLab