ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
ff6046
From 8ae19bfcfe0a52b55171f4f60772afe418831230 Mon Sep 17 00:00:00 2001
ff6046
From: Yu Watanabe <watanabe.yu+github@gmail.com>
ff6046
Date: Wed, 27 Jun 2018 14:50:19 +0900
ff6046
Subject: [PATCH] journal-gateway: use localStorage["cursor"] only when it has
ff6046
 valid value
ff6046
ff6046
Discovered by LGTM.
ff6046
ff6046
(cherry picked from commit 944072feddb73333023d0a98bf87fd2a17f894d3)
ff6046
ff6046
Resolves: #1705971
ff6046
---
ff6046
 src/journal-remote/browse.html | 10 ++++++----
ff6046
 1 file changed, 6 insertions(+), 4 deletions(-)
ff6046
ff6046
diff --git a/src/journal-remote/browse.html b/src/journal-remote/browse.html
ff6046
index 9f519adbd6..e5162d1088 100644
ff6046
--- a/src/journal-remote/browse.html
ff6046
+++ b/src/journal-remote/browse.html
ff6046
@@ -236,10 +236,12 @@
ff6046
 
ff6046
                 function entriesLoad(range) {
ff6046
 
ff6046
-                        if (range == null)
ff6046
-                                range = localStorage["cursor"] + ":0";
ff6046
-                        if (range == null)
ff6046
-                                range = "";
ff6046
+                        if (range == null) {
ff6046
+                                if (localStorage["cursor"] != null && localStorage["cursor"] != "")
ff6046
+                                        range = localStorage["cursor"] + ":0";
ff6046
+                                else
ff6046
+                                        range = "";
ff6046
+                        }
ff6046
 
ff6046
                         var url = "/entries";
ff6046