ryantimwilson / rpms / systemd

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