diff --git a/CHANGELOG.md b/CHANGELOG.md index bf52f0f..0f443d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ MumbleDJ Changelog ### February 2, 2015 -- `v2.3.4, v2.3.5` * Added panic on audio play fail for debugging purposes. * Fixed '!' being recognized as '!skipplaylist'. +* Fixed !reset crash when there is no audio playing. ### January 30, 2015 -- `v2.3.3` * Fixed private messages crashing the bot when the target user switches channels or disconnects. diff --git a/commands.go b/commands.go index 31b50ee..ec4402a 100644 --- a/commands.go +++ b/commands.go @@ -304,12 +304,13 @@ func reload(user *gumble.User) { // remaining songs in the ~/.mumbledj/songs directory. func reset(username string) { dj.queue.queue = dj.queue.queue[:0] - if err := dj.audioStream.Stop(); err == nil { - if err := deleteSongs(); err == nil { - dj.client.Self().Channel().Send(fmt.Sprintf(QUEUE_RESET_HTML, username), false) - } else { + if dj.audioStream.IsPlaying() { + if err := dj.audioStream.Stop(); err != nil { panic(err) } + } + if err := deleteSongs(); err == nil { + dj.client.Self().Channel().Send(fmt.Sprintf(QUEUE_RESET_HTML, username), false) } else { panic(err) }