1
0

In PlaylistNext() CheckAndUpdateMostListenedSong() call was moved after songList.Add to avoid nil pointer dereferencing.

This commit is contained in:
Alexander Andreev 2023-10-07 05:34:50 +04:00
parent f0420e9bcd
commit b8afed6e1b
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -65,8 +65,8 @@ func (dj *DJHandlers) PlaylistNext(w http.ResponseWriter, _ *http.Request) {
Duration: oggf.GetDuration(),
MaxListeners: dj.listeners.Current(),
StartAt: time.Now()}
radio.CheckAndUpdateMostListenedSong(*dj.songList.Current())
dj.songList.Add(song)
radio.CheckAndUpdateMostListenedSong(*dj.songList.Current())
}()
}
fmt.Fprintln(w, nxt)