Skip to content

Instantly share code, notes, and snippets.

@fkaa
Created January 12, 2020 17:09
Show Gist options
  • Save fkaa/c1c1cd55838e7b34ebe336a87aef29b6 to your computer and use it in GitHub Desktop.
Save fkaa/c1c1cd55838e7b34ebe336a87aef29b6 to your computer and use it in GitHub Desktop.
diff --git a/src/main.rs b/src/main.rs
index c4fdd2f..acaaa9d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -185,8 +185,12 @@ impl Application {
}
}
Some("play") => {
+ let playlist = self.playlist.lock().expect("Mutex was not poisoned");
+
if !self.player.is_started() {
- self.player.stop_current();
+ if !playlist.is_empty() {
+ self.player.stop_current();
+ }
} else {
self.player.play()?;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment