From 2e60f2bb8a682ac294e319bdf77e9324de30254e Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Mon, 13 Mar 2023 01:42:24 +0400 Subject: [PATCH] Check for empty prev song. --- internal/radio/mostlistened.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/radio/mostlistened.go b/internal/radio/mostlistened.go index c3cf249..29df1c5 100644 --- a/internal/radio/mostlistened.go +++ b/internal/radio/mostlistened.go @@ -31,6 +31,9 @@ var mostListened MostListenedSong // So it would be fairer to give these listeners back to a song they was // listening to. func CheckAndUpdateMostListenedSong(cur, prev Song) { + if prev.Song == "" { + return + } l, _ := strconv.Atoi(cur.Listeners) if l > mostListened.Listeners { mostListened = MostListenedSong{