From 63e6195d8b8f2d1b03141b58c5d7bd73fa2d1c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20=C5=A0est=C3=A1k?= Date: Thu, 21 Sep 2023 21:36:38 +0200 Subject: [PATCH] Fix undefined behavior with substring with empty location.search --- client/src/main/scala/com/v6ak/zbdb/App.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/main/scala/com/v6ak/zbdb/App.scala b/client/src/main/scala/com/v6ak/zbdb/App.scala index a22859d..094d31a 100644 --- a/client/src/main/scala/com/v6ak/zbdb/App.scala +++ b/client/src/main/scala/com/v6ak/zbdb/App.scala @@ -26,7 +26,7 @@ object App { dom.console.log("startTime", startTime.toString) dom.console.log("endTime", endTime.toString) dom.console.log("fileName", fileName) - val params = dom.window.location.search.substring(1).split("&").map{paramString => + val params = dom.window.location.search.drop(1).split("&").map{paramString => paramString.split("=", 2) match { case Array(name, value) => (name, value) case Array(name) => (name, "")