From 45ef973627f6e120d7fc8836f0c74e08e438d6a2 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 22 Mar 2019 06:10:20 +0100 Subject: [PATCH] Fix a javascript null-deref This commit should fix the following javascript crash that may occur if the localstorage isn't available/supported by the browser: ``` more.view:140 Uncaught TypeError: Cannot read property 'playCountValue' of null at loadShuffleForm (more.view:140) at HTMLDocument. (more.view:181) at n (jquery-1.7.1.min.js:2) at Object.fireWith (jquery-1.7.1.min.js:2) at Function.ready (jquery-1.7.1.min.js:2) at HTMLDocument.B (jquery-1.7.1.min.js:2) ``` Signed-off-by: jvoisin --- airsonic-main/src/main/webapp/WEB-INF/jsp/more.jsp | 1 + 1 file changed, 1 insertion(+) diff --git a/airsonic-main/src/main/webapp/WEB-INF/jsp/more.jsp b/airsonic-main/src/main/webapp/WEB-INF/jsp/more.jsp index ad7f8092..8b3facea 100644 --- a/airsonic-main/src/main/webapp/WEB-INF/jsp/more.jsp +++ b/airsonic-main/src/main/webapp/WEB-INF/jsp/more.jsp @@ -60,6 +60,7 @@ try { var data = JSON.parse(localStorage.getItem("randomPlayQueue")); } catch(e) { return; } + if (data == null ) { return; } elements = form.getElementsByTagName("input"); for (var i = 0; i < elements.length; i++) { if (elements[i].type == "hidden") continue;