SongList.Current() now returns a copy of Song instead of a pointer.
This commit is contained in:
parent
9b14d7846b
commit
9beb179cc0
@ -77,13 +77,13 @@ func (sl *SongList) Add(newSong Song) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Current returns a currently playing song.
|
// Current returns a currently playing song.
|
||||||
func (sl *SongList) Current() *Song {
|
func (sl *SongList) Current() Song {
|
||||||
sl.Lock()
|
sl.Lock()
|
||||||
defer sl.Unlock()
|
defer sl.Unlock()
|
||||||
if sl.current.StartAt.Year() == 1 {
|
if sl.current.StartAt.Year() == 1 {
|
||||||
return nil
|
return Song{}
|
||||||
}
|
}
|
||||||
return &sl.current
|
return sl.current
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateCurrentMaxListeners checks and updates a maximal number of listeners
|
// UpdateCurrentMaxListeners checks and updates a maximal number of listeners
|
||||||
|
Loading…
Reference in New Issue
Block a user