dweymouth / supersonic

A lightweight and full-featured cross-platform desktop client for self-hosted music servers
GNU General Public License v3.0
682 stars 27 forks source link

Segmentation fault when playing artist radio #158

Closed TheSunCat closed 1 year ago

TheSunCat commented 1 year ago

When viewing an artist on my Funkwhale server with Supersonic, pressing the "Play Artist Radio" button causes the app to crash with a segfault. Here is the end of the log (the XML syntax error is printed repeatedly while using the app but not during the crash, so I don't think it's related, but including it just in case):

2023/05/07 10:50:59   At: /home/apm/.cache/paru/clone/supersonic-desktop/src/gopath/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20230505012127-ca61c153b2a5/internal/svg/svg.go:27
2023/05/07 10:50:59 Fyne error:  could not load SVG, falling back to static content:
2023/05/07 10:50:59   Cause: XML syntax error on line 3: invalid character entity & (no semicolon)
2023/05/07 10:50:59   At: /home/apm/.cache/paru/clone/supersonic-desktop/src/gopath/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20230505012127-ca61c153b2a5/internal/svg/svg.go:27
2023/05/07 10:50:59 Fyne error:  could not load SVG, falling back to static content:
2023/05/07 10:50:59   Cause: XML syntax error on line 3: invalid character entity & (no semicolon)
2023/05/07 10:50:59   At: /home/apm/.cache/paru/clone/supersonic-desktop/src/gopath/pkg/mod/github.com/dweymouth/fyne/v2@v2.3.0-rc1.0.20230505012127-ca61c153b2a5/internal/svg/svg.go:27
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x714c62]

goroutine 143 [running]:
github.com/dweymouth/go-subsonic/subsonic.(*Client).GetSimilarSongs2(0xbb8520?, {0xc00367fa58, 0x3}, 0x4?)
    /home/apm/.cache/paru/clone/supersonic-desktop/src/gopath/pkg/mod/github.com/dweymouth/go-subsonic@v0.0.0-20230210044542-537b9238299b/subsonic/browsing.go:171 +0x1c2
supersonic/backend.(*PlaybackManager).PlaySimilarSongs(0xc000480410, {0xc00367fa58, 0x3})
    /home/apm/.cache/paru/clone/supersonic-desktop/src/supersonic-0.2.0/backend/playbackmanager.go:216 +0xfc
created by supersonic/ui/browsing.(*ArtistPage).playArtistRadio
    /home/apm/.cache/paru/clone/supersonic-desktop/src/supersonic-0.2.0/ui/browsing/artistpage.go:138 +0x9b
jprjr commented 1 year ago

Hi there, reporting the same issue when using gonic as a backend.

In my case with gonic - it appears the API call returns an empty response:

<subsonic-response status="ok" version="1.15.0" xmlns="http://subsonic.org/restapi" type="gonic"></subsonic-response>
dweymouth commented 1 year ago

Thanks for the report! My guess is that neither of those servers implements the getSimilarSongs2 endpoint which is needed for that feature, but Supersonic absolutely should not crash if it's not available. Will fix in the next release!

dweymouth commented 1 year ago

Should be fixed on the main branch now and will be in the next release!