diff options
author | David Athay <ko2fan@gmail.com> | 2008-04-18 15:23:49 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-04-18 15:23:49 +0000 |
commit | 4371c8c1ffcf24e8d5a7cf2ec126be239cab3d76 (patch) | |
tree | 831d9d2e909dabab0ee2c6ed640e290ee28ad294 /src/net | |
parent | 0b567928c0a24c7346451b59285ce8144ae0bf2e (diff) | |
download | mana-4371c8c1ffcf24e8d5a7cf2ec126be239cab3d76.tar.gz mana-4371c8c1ffcf24e8d5a7cf2ec126be239cab3d76.tar.bz2 mana-4371c8c1ffcf24e8d5a7cf2ec126be239cab3d76.tar.xz mana-4371c8c1ffcf24e8d5a7cf2ec126be239cab3d76.zip |
Fixed numerous crashes with chat and guild windows using new tabbed area.
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/chathandler.cpp | 14 | ||||
-rw-r--r-- | src/net/guildhandler.cpp | 9 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp index d8a228ea..d3dcd2b1 100644 --- a/src/net/chathandler.cpp +++ b/src/net/chathandler.cpp @@ -70,7 +70,7 @@ void ChatHandler::handleMessage(MessageIn &msg) short channelId; std::string userNick; std::string channelName; - //Sint16 chatMsgLength; + short error = -1; switch (msg.getId()) { @@ -88,7 +88,8 @@ void ChatHandler::handleMessage(MessageIn &msg) } break; case CPMSG_REGISTER_CHANNEL_RESPONSE: - if(msg.readInt8() == ERRMSG_OK) + error = msg.readInt8(); + if(error == ERRMSG_OK) { channelId = msg.readInt16(); std::string channelName = msg.readString(); @@ -98,7 +99,14 @@ void ChatHandler::handleMessage(MessageIn &msg) } else { - chatWindow->chatLog("Error registering channel", BY_SERVER); + if (error == ERRMSG_INVALID_ARGUMENT) + { + chatWindow->chatLog("Error registering channel - Invalid Channel Name given", BY_SERVER); + } + else + { + chatWindow->chatLog("Error registering channel", BY_SERVER); + } } break; case CPMSG_ENTER_CHANNEL_RESPONSE: diff --git a/src/net/guildhandler.cpp b/src/net/guildhandler.cpp index c178df18..05fa0953 100644 --- a/src/net/guildhandler.cpp +++ b/src/net/guildhandler.cpp @@ -168,8 +168,13 @@ void GuildHandler::handleMessage(MessageIn &msg) // Must remove tab first, as it wont find the guild // name after its removed from the player int guildId = msg.readInt16(); - guildWindow->removeTab(guildId); - player_node->removeGuild(guildId); + Guild *guild = player_node->getGuild(guildId); + if (guild) + { + chatWindow->removeChannel(guild->getName()); + guildWindow->removeTab(guildId); + player_node->removeGuild(guildId); + } } } break; } |