From e0f206bc0cb77643a60fabba20de37c00c652d80 Mon Sep 17 00:00:00 2001 From: Simon Diesenreiter Date: Sun, 25 May 2025 21:36:34 +0200 Subject: [PATCH] fix: exception thrown on LastOrDefault(), refs NOISSUE --- song_of_the_day/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/song_of_the_day/Program.cs b/song_of_the_day/Program.cs index 81ffd7f..4230016 100644 --- a/song_of_the_day/Program.cs +++ b/song_of_the_day/Program.cs @@ -92,7 +92,7 @@ pickOfTheDayTimer.OnOccurence += async (s, ea) => { var dci = DataContext.Instance; - var lastSong = dci.SongSuggestions?.LastOrDefault(); + var lastSong = dci.SongSuggestions?.OrderBy(s => s.Id).LastOrDefault(); if (lastSong != null && lastSong.Date >= DateTime.Today.Subtract(TimeSpan.FromDays(AppConfiguration.Instance.DaysBetweenRequests))) {