From 340ad570b65e3a941ae3fcb437aa96de424eeeda Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Sun, 21 Feb 2021 20:44:48 +0100 Subject: [PATCH] add fallback if state is not in uri --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index e2b0aab..1717453 100644 --- a/index.js +++ b/index.js @@ -427,7 +427,12 @@ function serializeNeutrinoData(data) { function getWindowNeutrinoData() { const data_string = decodeURI(window.location.href); - return JSON.parse(data_string.slice(data_string.indexOf("?settings=") + "?settings=".length)); + const json = data_string.slice(data_string.indexOf("?settings=") + "?settings=".length); + + if(!json) + return defaultNeutrinoData; + + return JSON.parse(); } let historyTimeout = null;