Skip to content

Commit 32e7a13

Browse files
committed
prevent from json error
1 parent 43abcc4 commit 32e7a13

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

web_src/js/components/RepoActionView.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ type LocaleStorageOptions = {
4949
};
5050
5151
function getLocaleStorageOptions(): LocaleStorageOptions {
52-
const optsJson = localStorage.getItem('actions-view-options');
53-
if (optsJson) return JSON.parse(optsJson);
52+
try {
53+
const optsJson = localStorage.getItem('actions-view-options');
54+
if (optsJson) return JSON.parse(optsJson);
55+
} catch {}
56+
// if no options in localStorage, or failed to parse, return default options
5457
return {autoScroll: true, expandRunning: false};
5558
}
5659

0 commit comments

Comments
 (0)