Skip to content

Commit 7fcb7bf

Browse files
author
Harry Bock
committed
Fix viewing empty log list.
Caused an internal service error due to not checking for an empty list.
1 parent 61f4b61 commit 7fcb7bf

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

lisp/report-handlers.lisp

+16-14
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,20 @@ the pathname of the log itself."
7676

7777
(defun daily-split-hourly-logs ()
7878
(let ((logs (hourly-logs)) day-logs log-list)
79-
(loop
80-
:with day = (this-day (car (first logs)))
81-
:for log :in logs
82-
:if (= (this-day (car log)) day)
83-
:do (push log day-logs)
84-
:else :do
85-
(push (nreverse day-logs) log-list)
86-
(setf day-logs nil)
87-
(setf day (this-day (car log)))
88-
(push log day-logs))
89-
(when day-logs
90-
(push (nreverse day-logs) log-list))
91-
log-list))
79+
(when logs
80+
(loop
81+
:with day = (this-day (car (first logs)))
82+
:for log :in logs
83+
:if (= (this-day (car log)) day)
84+
:do (push log day-logs)
85+
:else :do
86+
(push (nreverse day-logs) log-list)
87+
(setf day-logs nil)
88+
(setf day (this-day (car log)))
89+
(push log day-logs))
90+
(when day-logs
91+
(push (nreverse day-logs) log-list))
92+
log-list)))
9293

9394
(defun print-hourly-list ()
9495
"Print out the hourly log list HTML, with newest logs first."
@@ -98,7 +99,8 @@ the pathname of the log itself."
9899
(:h2 "Hourly Report Listing")
99100
(let ((daily-logs (daily-split-hourly-logs)))
100101
(when (null daily-logs)
101-
(htm (:br) "No hourly reports available!"))
102+
(htm (:br) "No hourly reports available!")
103+
(return-from print-hourly-list nil))
102104

103105
(dolist (logs daily-logs)
104106
(let ((log-day (this-day (car (first logs)))))

0 commit comments

Comments
 (0)