diff --git a/browserid/static/dialog/main.js b/browserid/static/dialog/main.js index e1111069749edc8bcb812503914d5f7c5ea81a48..e17f0ce41c3b9bd7410781ae12e8f6b2ea17a71c 100644 --- a/browserid/static/dialog/main.js +++ b/browserid/static/dialog/main.js @@ -49,8 +49,14 @@ { var emails = {}; if (window.localStorage.emails) { - emails = JSON.parse(window.localStorage.emails); + try { + emails = JSON.parse(window.localStorage.emails); + } catch(e) { + // if somehow window.localStorage.emails is populated with bogus + // JSON, we'll just purge it. + } } + if (emails === null || typeof emails !== 'object') emails = {}; emails[email] = { created: new Date(),