summaryrefslogtreecommitdiff
path: root/src/net/ea/partyhandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-10-08 01:00:52 +0300
committerAndrei Karas <akaras@inbox.ru>2011-10-08 01:02:48 +0300
commit29187a2582c04e3ede63f9c58f09dbbe34834a30 (patch)
tree93b77c0ad573af9c6d52a6932e76f6c223e2c8f3 /src/net/ea/partyhandler.cpp
parentaf98cb5dea5644e0d95a5bf41c03655e4ab808ef (diff)
downloadmv-29187a2582c04e3ede63f9c58f09dbbe34834a30.tar.gz
mv-29187a2582c04e3ede63f9c58f09dbbe34834a30.tar.bz2
mv-29187a2582c04e3ede63f9c58f09dbbe34834a30.tar.xz
mv-29187a2582c04e3ede63f9c58f09dbbe34834a30.zip
Add checks and fix code style.
Diffstat (limited to 'src/net/ea/partyhandler.cpp')
-rw-r--r--src/net/ea/partyhandler.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 36e192ce8..35cc77fbf 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -40,7 +40,7 @@ namespace Ea
PartyTab *partyTab = 0;
Party *taParty = 0;
-PartyHandler::PartyHandler():
+PartyHandler::PartyHandler() :
mShareExp(PARTY_SHARE_UNKNOWN),
mShareItems(PARTY_SHARE_UNKNOWN)
{
@@ -344,7 +344,10 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg)
int id = msg.readInt32();
std::string nick = msg.readString(24);
msg.readInt8(); // fail
- if (player_node && id == player_node->getId())
+ if (!player_node)
+ return;
+
+ if (id == player_node->getId())
{
if (Ea::taParty)
{
@@ -431,21 +434,18 @@ void PartyHandler::processPartyMessage(Net::MessageIn &msg)
int id = msg.readInt32();
std::string chatMsg = msg.readString(msgLength);
- if (Ea::taParty)
+ if (Ea::taParty && Ea::partyTab)
{
PartyMember *member = Ea::taParty->getMember(id);
- if (Ea::partyTab)
+ if (member)
{
- if (member)
- {
- Ea::partyTab->chatLog(member->getName(), chatMsg);
- }
- else
- {
- Ea::partyTab->chatLog(strprintf(
- _("An unknown member tried to say: %s"),
- chatMsg.c_str()), BY_SERVER);
- }
+ Ea::partyTab->chatLog(member->getName(), chatMsg);
+ }
+ else
+ {
+ Ea::partyTab->chatLog(strprintf(
+ _("An unknown member tried to say: %s"),
+ chatMsg.c_str()), BY_SERVER);
}
}
}