From 7c8d5dc740c701b2f744fe492753a876270ac689 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Fri, 20 Mar 2020 10:30:24 +0100
Subject: [PATCH] Fix the 'empty news bug'

---
 server/routes/news.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/routes/news.js b/server/routes/news.js
index 51d8c824..af7f6ac0 100644
--- a/server/routes/news.js
+++ b/server/routes/news.js
@@ -24,8 +24,8 @@ router.get("/news", access.ajax, (req,res) => {
 
 router.get("/newsts", access.ajax, (req,res) => {
   // Special query for footer: just return timestamp of last news
-  NewsModel.getTimestamp((err,ts) => {
-    res.json(err || { timestamp: ts.added });
+  NewsModel.getTimestamp((err, ts) => {
+    res.json(err || { timestamp: !!ts ? ts.added : 0 });
   });
 });
 
-- 
2.44.0