summaryrefslogtreecommitdiff
path: root/src/net/manaserv/chathandler.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-11-04 18:25:33 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-11-12 02:49:10 +0100
commit06c26c4b05560a09f070930a03635650a3fba351 (patch)
treeac796999290038a2b28d6e3596949eda704046b1 /src/net/manaserv/chathandler.cpp
parenta1e61f8446b7928d854a062f6494e75fe3fec9ab (diff)
downloadmana-client-06c26c4b05560a09f070930a03635650a3fba351.tar.gz
mana-client-06c26c4b05560a09f070930a03635650a3fba351.tar.bz2
mana-client-06c26c4b05560a09f070930a03635650a3fba351.tar.xz
mana-client-06c26c4b05560a09f070930a03635650a3fba351.zip
Prevent a potential crash when the chat channel is wrong.
Reviewed-by: Erik Schilling
Diffstat (limited to 'src/net/manaserv/chathandler.cpp')
-rw-r--r--src/net/manaserv/chathandler.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp
index 6c97fae3..efb156f0 100644
--- a/src/net/manaserv/chathandler.cpp
+++ b/src/net/manaserv/chathandler.cpp
@@ -255,7 +255,17 @@ void ChatHandler::handleChatMessage(Net::MessageIn &msg)
std::string chatMsg = msg.readString();
Channel *channel = channelManager->findById(channelId);
- channel->getTab()->chatLog(userNick, chatMsg);
+ if (channel)
+ {
+ ChannelTab *tab = channel->getTab();
+ if (tab)
+ tab->chatLog(userNick, chatMsg);
+ }
+ else
+ {
+ // Can't find channel
+ logger->log("Couldn't find chat channel id: %hi", channelId);
+ }
}
void ChatHandler::handleQuitChannelResponse(Net::MessageIn &msg)