Skip to content

Commit dead093

Browse files
committed
2 parents c6efbd9 + 6b8ba30 commit dead093

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/stores.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ function createCalorieDateMap() {
88
const store = writable({} as CalorieDateMap);
99
const { subscribe, set } = store;
1010

11-
localStorage.calorieMap && set(JSON.parse(localStorage.calorieMap));
11+
const stored = localStorage.calorieMap ?? '{}';
12+
try {
13+
set(JSON.parse(stored));
14+
} catch {
15+
set({});
16+
}
1217

1318
return {
1419
subscribe,

0 commit comments

Comments
 (0)