1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-22 16:44:26 +00:00

prevent from json error

This commit is contained in:
wxiaoguang 2024-12-22 12:16:12 +08:00
parent 43abcc42ae
commit 32e7a13b60

View File

@ -49,8 +49,11 @@ type LocaleStorageOptions = {
};
function getLocaleStorageOptions(): LocaleStorageOptions {
const optsJson = localStorage.getItem('actions-view-options');
if (optsJson) return JSON.parse(optsJson);
try {
const optsJson = localStorage.getItem('actions-view-options');
if (optsJson) return JSON.parse(optsJson);
} catch {}
// if no options in localStorage, or failed to parse, return default options
return {autoScroll: true, expandRunning: false};
}