summaryrefslogtreecommitdiff
path: root/src/net/tmwa/charserverhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-10-17 22:07:24 +0300
committerAndrei Karas <akaras@inbox.ru>2011-10-17 22:07:24 +0300
commitd14bb7a27ee23cc83b3af1db2f1976eaaa55d78a (patch)
tree5f128768c66436eefd70632f02889607596609d4 /src/net/tmwa/charserverhandler.cpp
parentf1e92aca00a4859047e83fab76220767b9a2f814 (diff)
parente93e6beb456d105987da3190c2a80847b6900081 (diff)
downloadplus-stripped1.1.10.16.tar.gz
plus-stripped1.1.10.16.tar.bz2
plus-stripped1.1.10.16.tar.xz
plus-stripped1.1.10.16.zip
Merge branch 'master' into strippedstripped1.1.10.16
Conflicts: data/fonts/mplus-1p-bold.ttf data/fonts/mplus-1p-regular.ttf
Diffstat (limited to 'src/net/tmwa/charserverhandler.cpp')
-rw-r--r--src/net/tmwa/charserverhandler.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 7aa68e617..03b63aa16 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -157,7 +157,7 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
break;
default:
- break;
+ break;
}
}
@@ -165,8 +165,11 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
Net::Character *character,
bool withColors)
{
+ if (!character)
+ return;
+
const Token &token =
- static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
+ static_cast<LoginHandler*>(Net::getLoginHandler())->getToken();
LocalPlayer *tempPlayer = new LocalPlayer(msg.readInt32(), 0);
tempPlayer->setGender(token.sex);
@@ -264,6 +267,9 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
void CharServerHandler::chooseCharacter(Net::Character *character)
{
+ if (!character)
+ return;
+
mSelectedCharacter = character;
mCharSelectDialog = 0;
@@ -338,10 +344,8 @@ void CharServerHandler::processCharLogin(Net::MessageIn &msg)
msg.skip(2); // Length word
int slots = msg.readInt16();
if (slots > 0 && slots < 30)
- {
- loginData.characterSlots
- = static_cast<short unsigned int>(slots);
- }
+ loginData.characterSlots = static_cast<short unsigned int>(slots);
+
bool version = msg.readInt8() == 1 && serverVersion > 0;
msg.skip(17); // Unused