summaryrefslogtreecommitdiff
path: root/src/net/ea/playerhandler.cpp
diff options
context:
space:
mode:
authorFreeyorp <Freeyorp101@hotmail.com>2009-12-19 20:12:06 +1300
committerFreeyorp <Freeyorp101@hotmail.com>2009-12-19 20:12:06 +1300
commit2968691478f6479e98377ca500a0da69bc0f392a (patch)
treedb22141937b53751369ccf83eee1226c9960a96c /src/net/ea/playerhandler.cpp
parent6ad0ab8123de1ee3f27ad38300dc7ef896bab569 (diff)
downloadmana-2968691478f6479e98377ca500a0da69bc0f392a.tar.gz
mana-2968691478f6479e98377ca500a0da69bc0f392a.tar.bz2
mana-2968691478f6479e98377ca500a0da69bc0f392a.tar.xz
mana-2968691478f6479e98377ca500a0da69bc0f392a.zip
Fix a race condition
If the server tells the client to update the mp bar when handling an matk change message before the status window has initialised, a segfault occurs
Diffstat (limited to 'src/net/ea/playerhandler.cpp')
-rw-r--r--src/net/ea/playerhandler.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 5db4acbe..0592bb55 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -260,10 +260,14 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
case 0x002b: player_node->setAttributeEffective(MATK, value
+ ATTR_BONUS(MATK));
player_node->setAttributeBase(MATK, value);
- statusWindow->update(StatusWindow::MP); break;
+ if (statusWindow)
+ statusWindow->update(StatusWindow::MP);
+ break;
case 0x002c: value += player_node->getAttributeBase(MATK);
player_node->setAttributeEffective(MATK, value);
- statusWindow->update(StatusWindow::MP); break;
+ if (statusWindow)
+ statusWindow->update(StatusWindow::MP);
+ break;
case 0x002d: player_node->setAttributeEffective(DEF, value
+ ATTR_BONUS(DEF));
player_node->setAttributeBase(DEF, value); break;