1
0

Check for empty prev song.

This commit is contained in:
Alexander Andreev 2023-03-13 01:42:24 +04:00
parent f24953ae7c
commit 2e60f2bb8a
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -31,6 +31,9 @@ var mostListened MostListenedSong
// So it would be fairer to give these listeners back to a song they was // So it would be fairer to give these listeners back to a song they was
// listening to. // listening to.
func CheckAndUpdateMostListenedSong(cur, prev Song) { func CheckAndUpdateMostListenedSong(cur, prev Song) {
if prev.Song == "" {
return
}
l, _ := strconv.Atoi(cur.Listeners) l, _ := strconv.Atoi(cur.Listeners)
if l > mostListened.Listeners { if l > mostListened.Listeners {
mostListened = MostListenedSong{ mostListened = MostListenedSong{