From 305b7a58e93a673c365589a16dd792417e7c2203 Mon Sep 17 00:00:00 2001 From: "Felix W. Dekker" Date: Sat, 15 Jun 2019 14:41:43 +0200 Subject: [PATCH] Do not split cookie if it does not exist --- index.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index cdf477d..f25a0b1 100644 --- a/index.html +++ b/index.html @@ -119,7 +119,16 @@ /** * (De)selects signatures based on the selection stored in a cookie. */ - const loadSelectedSignaturesFromCookie = () => setSelectedSignatures(Cookies.get("selectedSignatures").split(",")); + const loadSelectedSignaturesFromCookie = () => { + const cookie = Cookies.get("selectedSignatures"); + let signatures; + if (cookie === undefined) + signatures = []; + else + signatures = cookie.split(","); + + setSelectedSignatures(signatures); + }; /** * Saves the currently-selected signatures to a cookie.