mirror of
https://github.com/librespot-org/librespot.git
synced 2026-04-27 08:15:50 +03:00
[GH-ISSUE #845] Playlist::get panics if the playlist contains tracks from Local Files #424
Labels
No labels
A-Alsa
SpotifyAPI
Tokio 1.0
audio
bug
can't reproduce
compilation
dependencies
duplicate
enhancement
good first issue
help wanted
high priority
imported
imported
invalid
new api
pull-request
question
reverse engineering
wiki
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/librespot#424
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @RainbowCookie32 on GitHub (Sep 14, 2021).
Original GitHub issue: https://github.com/librespot-org/librespot/issues/845
Seems like SpotifyId::from_base62() can't handle tracks from local files, since it returns Err.
This leads to the unwrap() on the parse function called from Playlist::get (here) to cause a panic and crash my application with:
It'd be nice for the error to be handled instead of just panicking. I don't know if handling local files is possible, but even just ignoring tracks whose SpotifyId returns Err would be a better stop-gag solution in my case.
@roderickvd commented on GitHub (Sep 15, 2021):
Yeah, seems right. Do you know your way around Rust to submit a PR? I see more than one Rust project listed on your GitHub profile 😉
@RainbowCookie32 commented on GitHub (Sep 15, 2021):
I can give it a spin. Would replacing
with
be good enough in your opinion? Not gonna lie, I've barely used map() (or most functions with iterators) in my time with Rust.
Edit: It's not
@RainbowCookie32 commented on GitHub (Sep 15, 2021):
Cooked this up. If it's fine, I can open a PR for it
@ashthespy commented on GitHub (Sep 16, 2021):
Try looking at
filter_map:-)Something like this should be sufficient.. (please do test though!)
@RainbowCookie32 commented on GitHub (Sep 16, 2021):
I knew there had to be a nicer way 😅
Seems to work fine, will PR it. Thanks for the help guys!