journal-gateway: use localStorage["cursor"] only when it has valid value
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 27 Jun 2018 05:50:19 +0000 (14:50 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 27 Jun 2018 05:50:23 +0000 (14:50 +0900)
Discovered by LGTM.

src/journal-remote/browse.html

index 9f519ad..e5162d1 100644 (file)
 
                 function entriesLoad(range) {
 
-                        if (range == null)
-                                range = localStorage["cursor"] + ":0";
-                        if (range == null)
-                                range = "";
+                        if (range == null) {
+                                if (localStorage["cursor"] != null && localStorage["cursor"] != "")
+                                        range = localStorage["cursor"] + ":0";
+                                else
+                                        range = "";
+                        }
 
                         var url = "/entries";