fix: don't crash when to-be-prefetched track uri is empty#98
fix: don't crash when to-be-prefetched track uri is empty#98aykevl wants to merge 1 commit intodevgianlu:masterfrom
Conversation
I'm not sure how to trigger this exactly. It happens when playing albums, and maybe has something to do with the web player and/or switching between players. But it does happen sometimes and just crashing isn't great.
| if next.Uri != "" { | ||
| nextId = librespot.SpotifyIdFromUri(next.Uri) | ||
| } else { | ||
| nextId = librespot.SpotifyIdFromGid(librespot.SpotifyIdTypeTrack, next.Gid) |
There was a problem hiding this comment.
Are we sure SpotifyIdTypeTrack is always the correct type? Episode might end up here too. A call to InferSpotifyIdTypeFromContextUri might be needed.
There was a problem hiding this comment.
I'm not. I'll investigate this a bit more and hope to find some reliable reproducer so I can test this with some podcasts. Until then, I'm not fully convinced yet this is a correct fix.
Thanks for the pointer towards InferSpotifyIdTypeFromContextUri!
|
This looks reasonable to me. Unlucikly it is always very unpredicatable whether the uri or gid fields will be used. Feel free to refactor the code in a function if you want to. |
This should be implemented some day, but until it is this at least keeps the player from crashing. This is a more conservative alternative to devgianlu#98.
This should be implemented some day, but until it is this at least keeps the player from crashing. This is a more conservative alternative to devgianlu#98.
|
Closing for now in favor of #110. Once I figure out what's going on here, I might make a new PR that actually implements this stuff. |
This should be implemented some day, but until it is this at least keeps the player from crashing. This is a more conservative alternative to #98.
This should be implemented some day, but until it is this at least keeps the player from crashing. This is a more conservative alternative to devgianlu#98.
This should be implemented some day, but until it is this at least keeps the player from crashing. This is a more conservative alternative to devgianlu#98.
I'm not sure how to trigger this exactly. It happens when playing albums, and maybe has something to do with the web player and/or switching between players. But it does happen sometimes and just crashing isn't great.
I'm sure I've seen this working as intended (fetching the next track from the
Gidfield) but because it's hard to reproduce I'm not sure how to test this further. I will keep my debug code in place to see whether the new code path indeed works as expected and will report back if it does.This fixes #97