Skip to content

Commit b9be243

Browse files
author
Saurabh Kumar Bajpai
committed
fix: add error handling for localStorage and HTTP requests
1 parent af173a5 commit b9be243

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎frontend/js/community-stories.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ document.addEventListener('DOMContentLoaded', () => {
4949
}
5050
];
5151

52-
let stories = JSON.parse(localStorage.getItem('bibliodrift_community_stories')) || defaultStories;
52+
let (function(){ try { return JSON.parse(localStorage.getItem('bibliodrift_community_stories')); } catch { return null; } })() || defaultStories;
5353

5454
// Save to local storage
5555
const saveStories = () => {

0 commit comments

Comments
 (0)