diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-11-04 18:25:33 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-11-12 02:49:10 +0100 |
commit | 06c26c4b05560a09f070930a03635650a3fba351 (patch) | |
tree | ac796999290038a2b28d6e3596949eda704046b1 /src | |
parent | a1e61f8446b7928d854a062f6494e75fe3fec9ab (diff) | |
download | mana-06c26c4b05560a09f070930a03635650a3fba351.tar.gz mana-06c26c4b05560a09f070930a03635650a3fba351.tar.bz2 mana-06c26c4b05560a09f070930a03635650a3fba351.tar.xz mana-06c26c4b05560a09f070930a03635650a3fba351.zip |
Prevent a potential crash when the chat channel is wrong.
Reviewed-by: Erik Schilling
Diffstat (limited to 'src')
-rw-r--r-- | src/net/manaserv/chathandler.cpp | 12 |
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) |