fix: crash triggering by stop and play when playlist is empty, fixed #206.

This commit is contained in:
Terry Geng 2020-09-20 09:53:16 +08:00
parent 141977759f
commit fceb50e894
No known key found for this signature in database
GPG Key ID: F982F8EA1DF720E7

View File

@ -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):