diff options
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r-- | src/gui/chat.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index e9bed822..d2ec0ec9 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -286,8 +286,12 @@ void ChatWindow::chatSend(std::string const &nick, std::string const &msg, } else { - int channelId = channelManager->findByName(channelName)->getId(); - Net::ChatServer::chat(channelId, msg); + Channel *channel = channelManager->findByName(channelName); + if (channel) + { + int channelId = channel->getId(); + Net::ChatServer::chat(channelId, msg); + } } return; } @@ -497,8 +501,12 @@ ChatWindow::enterChannel(std::string channel, std::string password) void ChatWindow::sendToChannel(short channelId, std::string user, std::string msg) { - std::string channelName = channelManager->findById(channelId)->getName(); - chatLog(user + ": " + msg, user == player_node->getName() ? BY_PLAYER : BY_OTHER, channelName); + Channel *channel = channelManager->findById(channelId); + if (channel) + { + std::string channelName = channel->getName(); + chatLog(user + ": " + msg, user == player_node->getName() ? BY_PLAYER : BY_OTHER, channelName); + } } void |