fix crash on start if no playback context
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
abs3nt 2023-02-05 15:54:48 -08:00
parent 5804607c42
commit 7bd2b8c3db

View File

@ -468,6 +468,10 @@ func (m *mainModel) Typing(msg tea.KeyMsg) (bool, tea.Cmd) {
func (m *mainModel) getContext(playing *spotify.CurrentlyPlaying) (string, error) {
context := playing.PlaybackContext
uri_split := strings.Split(string(context.URI), ":")
if len(uri_split) < 3 {
return "", fmt.Errorf("NO URI")
}
id := strings.Split(string(context.URI), ":")[2]
switch context.Type {
case "album":