Use fallback date when there are no visible articles

This fixes a crash
This commit is contained in:
Chris Josten 2024-10-12 23:11:20 +02:00
parent 0e7aa0451f
commit 7bcc91a2fa
2 changed files with 4 additions and 2 deletions

View file

@ -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:

View file

@ -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
<?xml version="1.0" encoding="utf-8" ?>