fixed a NPD (Nil Pointer Dereference)
This commit is contained in:
parent
c580a4199e
commit
638f328330
1 changed files with 3 additions and 0 deletions
|
|
@ -59,6 +59,9 @@ func (r *nowPlayingRepository) Head(playerId int) (*engine.NowPlayingInfo, error
|
||||||
// TODO Will not work for multiple players
|
// TODO Will not work for multiple players
|
||||||
func (r *nowPlayingRepository) GetAll() ([]*engine.NowPlayingInfo, error) {
|
func (r *nowPlayingRepository) GetAll() ([]*engine.NowPlayingInfo, error) {
|
||||||
np, err := r.Head(1)
|
np, err := r.Head(1)
|
||||||
|
if np == nil || err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return []*engine.NowPlayingInfo{np}, err
|
return []*engine.NowPlayingInfo{np}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue