From fceb50e8943fb1f92537cd59b3b2ed16c14ce29b Mon Sep 17 00:00:00 2001 From: Terry Geng Date: Sun, 20 Sep 2020 09:53:16 +0800 Subject: [PATCH] fix: crash triggering by stop and play when playlist is empty, fixed #206. --- mumbleBot.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mumbleBot.py b/mumbleBot.py index 7a078d3..f1bc8ef 100644 --- a/mumbleBot.py +++ b/mumbleBot.py @@ -647,13 +647,16 @@ class MumbleBot: # Kill the ffmpeg thread and empty the playlist self.interrupt() var.playlist.clear() + self.wait_for_ready = False self.log.info("bot: music stopped. playlist trashed.") def stop(self): self.interrupt() self.is_pause = True - var.playlist.next() - self.wait_for_ready = True + if len(var.playlist) > 0: + self.wait_for_ready = True + else: + self.wait_for_ready = False self.log.info("bot: music stopped.") def interrupt(self):