In PlaylistNext() CheckAndUpdateMostListenedSong() call was moved after songList.Add to avoid nil pointer dereferencing.
This commit is contained in:
parent
f0420e9bcd
commit
b8afed6e1b
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user