summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJokler <jokler@protonmail.com>2020-01-12 23:05:45 +0100
committerJokler <jokler@protonmail.com>2020-01-12 23:05:45 +0100
commit5b9dea6a29faf4e1722dcc9d7437141c8a937a14 (patch)
tree1137664ca1c6c1a9fb0ca36fdcdf9f1978f86c12
parente163832efff8732dd732de1c42fcd3fef43e9824 (diff)
downloadpokebot-5b9dea6a29faf4e1722dcc9d7437141c8a937a14.tar.gz
pokebot-5b9dea6a29faf4e1722dcc9d7437141c8a937a14.zip
Fix error that occurs on incorrect play command
-rw-r--r--src/main.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index eced5db..1207d87 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()?;
}