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

@ -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" ?>