Skip to content

Commit f0d097a

Browse files
author
NI
committed
Add warning message when window.localStorage is disabled
1 parent b1cd29c commit f0d097a

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ui/home_historyctl.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
import { History } from "./commands/history.js";
22

33
export function build(ctx) {
4-
let rec = JSON.parse(localStorage.getItem("knowns"));
4+
let rec = [];
55

6-
if (!rec) {
7-
rec = [];
6+
try {
7+
rec = JSON.parse(localStorage.getItem("knowns"));
8+
9+
if (!rec) {
10+
rec = [];
11+
}
12+
} catch (e) {
13+
alert("Unable to load data of Known remotes: " + e);
814
}
915

1016
return new History(

0 commit comments

Comments
 (0)