diff options
| author | Jokler <jokler@protonmail.com> | 2020-01-12 23:05:45 +0100 |
|---|---|---|
| committer | Jokler <jokler@protonmail.com> | 2020-01-12 23:05:45 +0100 |
| commit | 5b9dea6a29faf4e1722dcc9d7437141c8a937a14 (patch) | |
| tree | 1137664ca1c6c1a9fb0ca36fdcdf9f1978f86c12 /src/main.rs | |
| parent | e163832efff8732dd732de1c42fcd3fef43e9824 (diff) | |
| download | pokebot-5b9dea6a29faf4e1722dcc9d7437141c8a937a14.tar.gz pokebot-5b9dea6a29faf4e1722dcc9d7437141c8a937a14.zip | |
Fix error that occurs on incorrect play command
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 6 |
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()?; } |
