fix crash
All checks were successful
continuous-integration/drone/tag Build is passing

This commit is contained in:
abs3nt 2023-01-16 21:12:46 -08:00
parent a758f7a199
commit eaf173573c

View File

@ -391,7 +391,7 @@ func (m *mainModel) Tick() {
select { select {
case <-ticker.C: case <-ticker.C:
playing, _ := m.client.PlayerCurrentlyPlaying(m.ctx) playing, _ := m.client.PlayerCurrentlyPlaying(m.ctx)
if playing != nil && playing.Playing { if playing != nil && playing.Playing && playing.Item != nil {
currentlyPlaying = "Now playing " + playing.Item.Name + " by " + playing.Item.Artists[0].Name currentlyPlaying = "Now playing " + playing.Item.Name + " by " + playing.Item.Artists[0].Name
} }
case <-quit: case <-quit:
@ -543,7 +543,7 @@ func InitMain(ctx *gctx.Context, client *spotify.Client, mode Mode) (tea.Model,
if err != nil { if err != nil {
return nil, err return nil, err
} }
if playing != nil && playing.Playing { if playing != nil && playing.Playing && playing.Item != nil {
currentlyPlaying = "Now playing " + playing.Item.Name + " by " + playing.Item.Artists[0].Name currentlyPlaying = "Now playing " + playing.Item.Name + " by " + playing.Item.Artists[0].Name
} }
items := []list.Item{} items := []list.Item{}