From edb98d5c1dce233f30ac4781bf74a939701291e9 Mon Sep 17 00:00:00 2001 From: JasonLG1979 Date: Mon, 31 Jan 2022 18:20:10 -0600 Subject: [PATCH 1/2] Prevent shuffle crash fixes https://github.com/librespot-org/librespot/issues/959 --- connect/src/spirc.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/connect/src/spirc.rs b/connect/src/spirc.rs index 344f63b7..b574ff52 100644 --- a/connect/src/spirc.rs +++ b/connect/src/spirc.rs @@ -668,15 +668,15 @@ impl SpircTask { self.state.set_shuffle(frame.get_state().get_shuffle()); if self.state.get_shuffle() { let current_index = self.state.get_playing_track_index(); - { - let tracks = self.state.mut_track(); + let tracks = self.state.mut_track(); + if !tracks.is_empty() { tracks.swap(0, current_index as usize); if let Some((_, rest)) = tracks.split_first_mut() { let mut rng = rand::thread_rng(); rest.shuffle(&mut rng); } + self.state.set_playing_track_index(0); } - self.state.set_playing_track_index(0); } else { let context = self.state.get_context_uri(); debug!("{:?}", context); From d54f3982a0b265e11270d2743d847853727dc67f Mon Sep 17 00:00:00 2001 From: JasonLG1979 Date: Tue, 1 Feb 2022 17:48:13 -0600 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24d1a17a..6db058bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [core] Removed unsafe code (breaking) - [playback] Adhere to ReplayGain spec when calculating gain normalisation factor. - [playback] `alsa`: Use `--volume-range` overrides for softvol controls +- [connect] Don't panic when activating shuffle without previous interaction. ### Removed - [playback] `alsamixer`: previously deprecated option `mixer-card` has been removed.