diff --git a/resources/static/shared/storage.js b/resources/static/shared/storage.js index b25b65af0c3c29ee472cf29a9ae9ddf094bc58ad..a7bad71bc18aa032b4b44688591d9698ba30d5a7 100644 --- a/resources/static/shared/storage.js +++ b/resources/static/shared/storage.js @@ -330,7 +330,13 @@ BrowserID.Storage = (function() { // this map helps us determine whether a specific email address belongs // to a user who has already confirmed their ownership of a computer. function updateEmailToUserIDMapping(userid, emails) { - var allInfo = JSON.parse(storage.emailToUserID || "{}"); + var allInfo; + try { + allInfo = JSON.parse(storage.emailToUserID); + if (typeof allInfo != 'object' || allInfo === null) throw "bogus"; + } catch(e) { + allInfo = {}; + } _.each(emails, function(email) { allInfo[email] = userid; });