Skip to content

Commit 733f664

Browse files
committed
Merge pull request #24 from arsnl/patch-1
Prevent JSON parse error on _get
2 parents 759672d + 655852c commit 733f664

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/hub.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,12 @@
188188

189189
for (i = 0; i < params.keys.length; i++) {
190190
key = params.keys[i];
191-
item = JSON.parse(storage.getItem(key));
191+
192+
try {
193+
item = JSON.parse(storage.getItem(key));
194+
} catch (e) {
195+
item = null;
196+
}
192197

193198
if (item === null) {
194199
result.push(null);

0 commit comments

Comments
 (0)