From 7bcc91a2fa68c44e1696c33c1ea9d6275d4c988e Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 12 Oct 2024 23:11:20 +0200 Subject: [PATCH] Use fallback date when there are no visible articles This fixes a crash --- public/static/style/base.css | 2 +- source/nl/netsoj/chris/blog/interfaces/http.d | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/static/style/base.css b/public/static/style/base.css index 6ac448a..7211e57 100644 --- a/public/static/style/base.css +++ b/public/static/style/base.css @@ -34,7 +34,7 @@ body { background-color: var(--colour-bg); margin: 0; display: grid; - grid-template-columns: 2em 200px max-content min-content; + grid-template-columns: 2em 200px 600px min-content; grid-column-gap: 2em; grid-template-rows: 2em min-content min-content 1fr; grid-template-areas: diff --git a/source/nl/netsoj/chris/blog/interfaces/http.d b/source/nl/netsoj/chris/blog/interfaces/http.d index db15abb..4f592cc 100644 --- a/source/nl/netsoj/chris/blog/interfaces/http.d +++ b/source/nl/netsoj/chris/blog/interfaces/http.d @@ -152,7 +152,9 @@ public: void getPostFeed(HTTPServerRequest req, HTTPServerResponse res) { Article[] articleList = articles.sortedList; - DateTime lastUpdated = articleList.map!"a.firstPublished()".maxElement; + DateTime lastUpdated = articleList.length > 0 + ? articleList.map!"a.firstPublished()".maxElement + : DateTime(2019, 06, 30); string response = q"EOS