diff --git a/lockr.js b/lockr.js index 0a41a14..a11a15a 100644 --- a/lockr.js +++ b/lockr.js @@ -67,11 +67,15 @@ try { value = JSON.parse(localStorage.getItem(query_key)); } catch (e) { - if( localStorage[query_key] ){ - value = JSON.parse('{"data":"' + localStorage.getItem(query_key) + '"}') - }else{ - value = null; - } + try { + if(localStorage[query_key]) { + value = JSON.parse('{"data":"' + localStorage.getItem(query_key) + '"}'); + } else{ + value = null; + } + } catch (e) { + if (console) console.warn("Lockr could not load the item with key " + key); + } } if(value === null) { return missing;