fixed a NPD (Nil Pointer Dereference)

This commit is contained in:
Deluan 2016-03-23 11:26:27 -04:00
parent c580a4199e
commit 638f328330

View File

@ -59,6 +59,9 @@ func (r *nowPlayingRepository) Head(playerId int) (*engine.NowPlayingInfo, error
// TODO Will not work for multiple players
func (r *nowPlayingRepository) GetAll() ([]*engine.NowPlayingInfo, error) {
np, err := r.Head(1)
if np == nil || err != nil {
return nil, err
}
return []*engine.NowPlayingInfo{np}, err
}