diff options
author | Stefan Dombrowski <stefan@uni-bonn.de> | 2011-02-21 13:43:23 +0100 |
---|---|---|
committer | Stefan Dombrowski <stefan@uni-bonn.de> | 2011-02-21 13:43:23 +0100 |
commit | 0e08e285b2d32e1d4e86b26e64141230e8e85397 (patch) | |
tree | ae44ef2b4fabd3ddfe2a463d03151f901b4eae19 /src | |
parent | 81c640c96d46a8791bf29291d4c8179b77306ce7 (diff) | |
download | mana-client-0e08e285b2d32e1d4e86b26e64141230e8e85397.tar.gz mana-client-0e08e285b2d32e1d4e86b26e64141230e8e85397.tar.bz2 mana-client-0e08e285b2d32e1d4e86b26e64141230e8e85397.tar.xz mana-client-0e08e285b2d32e1d4e86b26e64141230e8e85397.zip |
Fixing segmentation fault in chathandler
Reviewed-by: Jaxad0127, Thorbjorn
Diffstat (limited to 'src')
-rw-r--r-- | src/net/manaserv/chathandler.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp index da5dc79b..705795f4 100644 --- a/src/net/manaserv/chathandler.cpp +++ b/src/net/manaserv/chathandler.cpp @@ -27,6 +27,7 @@ #include "channel.h" #include "channelmanager.h" #include "event.h" +#include "log.h" #include "playerrelations.h" #include "gui/widgets/channeltab.h" @@ -155,13 +156,14 @@ void ChatHandler::handleGameChatMessage(Net::MessageIn &msg) Being *being = actorSpriteManager->findBeing(id); - std::string mes; - if (being) + if (!being) { - mes = being->getName() + " : " + chatMsg; + logger->log("Warning: Received GPMSG_SAY for unknown being with id %i." + " (Message is: %s)", id, chatMsg.c_str()); + return; } - else - mes = "Unknown : " + chatMsg; + + std::string mes = being->getName() + " : " + chatMsg; Mana::Event event(being == player_node ? EVENT_PLAYER : EVENT_BEING); event.setString("message", mes); |