devgianlu / go-librespot

Yet another open source Spotify client, written in Go.
GNU General Public License v3.0
128 stars 16 forks source link

panic: invalid uri: spotify:track:undefined #129

Closed lnkpaulo closed 3 days ago

lnkpaulo commented 3 days ago

Sending play request to http://localhost:3678/player/play where payload: _uri='spotify:track:undefined' skip_touri=None paused=False gives:

panic: invalid uri: spotify:track:undefined

goroutine 60 [running]:
github.com/devgianlu/go-librespot.SpotifyIdFromUri(...)
    /src/ids.go:114
main.(*AppPlayer).loadCurrentTrack(0xc0000e4800, 0x0, 0x1)
    /src/cmd/daemon/controls.go:199 +0xda5
main.(*AppPlayer).loadContext(0xc0000e4800, 0xc0002d7800, 0x0, 0x0, 0x1)
    /src/cmd/daemon/controls.go:189 +0x60e
main.(*AppPlayer).handleApiRequest(0xc0000e4800, {{0xacfb1e, 0x4}, {0xa462e0, 0xc000580450}, 0xc00061d320})
    /src/cmd/daemon/player.go:488 +0x708
main.(*AppPlayer).Run(0xc0000e4800, 0xc00003dc20)
    /src/cmd/daemon/player.go:578 +0x71a
created by main.(*App).withAppPlayer in goroutine 1
    /src/cmd/daemon/main.go:245 +0x2f1

basically the above happens when uri='spotify:track:undefined' .

devgianlu commented 3 days ago

Thank you for reporting. I have made it so that go-librespot will not panic.