From 0dcbd2803611ac6dc83da734ed366207369360c3 Mon Sep 17 00:00:00 2001 From: Matthieu Grieger Date: Sat, 18 Oct 2014 17:20:02 -0700 Subject: [PATCH] Fixed a crash related to default channels --- CHANGELOG.md | 2 ++ mumbledj/mumbledj.lua | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11832b1..cb162cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ MumbleDJ Changelog ### October 18, 2014 * Fixed a crash when an error occurs during the audio downloading & encoding process. +* Fixed a crash that occurs when the bot tries to join a default channel that does not exist. If the default channel does not exist, the bot will just move itself +to the root of the server instead. ### October 13, 2014 * Added `SETUP.md` which contains a guide on how to configure MumbleDJ and install its dependencies. diff --git a/mumbledj/mumbledj.lua b/mumbledj/mumbledj.lua index 3bcae85..c95a3ee 100644 --- a/mumbledj/mumbledj.lua +++ b/mumbledj/mumbledj.lua @@ -16,6 +16,10 @@ function piepan.onConnect() print(piepan.me.name .. " has connected to the server!") local user = piepan.users[piepan.me.name] local channel = user.channel(config.DEFAULT_CHANNEL) + if channel == nil then + print("The channel '" .. config.DEFAULT_CHANNEL .. "' does not exist. Moving bot to root of server...") + channel = piepan.channels[0] + end piepan.me:moveTo(channel) end