From f0d097ab12853325826c6aed3d87e36445211253 Mon Sep 17 00:00:00 2001 From: NI Date: Mon, 2 Sep 2019 13:20:57 +0800 Subject: [PATCH] Add warning message when window.localStorage is disabled --- ui/home_historyctl.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/home_historyctl.js b/ui/home_historyctl.js index b9cf4ba..c864f4c 100644 --- a/ui/home_historyctl.js +++ b/ui/home_historyctl.js @@ -1,10 +1,16 @@ import { History } from "./commands/history.js"; export function build(ctx) { - let rec = JSON.parse(localStorage.getItem("knowns")); + let rec = []; - if (!rec) { - rec = []; + try { + rec = JSON.parse(localStorage.getItem("knowns")); + + if (!rec) { + rec = []; + } + } catch (e) { + alert("Unable to load data of Known remotes: " + e); } return new History(