From: Benjamin Auder Date: Fri, 20 Mar 2020 09:30:24 +0000 (+0100) Subject: Fix the 'empty news bug' X-Git-Url: https://git.auder.net/images/doc/html/config.php?a=commitdiff_plain;h=7c8d5dc740c701b2f744fe492753a876270ac689;p=vchess.git Fix the 'empty news bug' --- 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 }); }); });