From 7bd2b8c3dbcabe6d6fb13d6b9a41dc7826bca671 Mon Sep 17 00:00:00 2001 From: abs3nt Date: Sun, 5 Feb 2023 15:54:48 -0800 Subject: [PATCH] fix crash on start if no playback context --- src/tui/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tui/main.go b/src/tui/main.go index 58a28cc..b22100e 100644 --- a/src/tui/main.go +++ b/src/tui/main.go @@ -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":