summaryrefslogtreecommitdiff
path: root/src/net/manaserv
diff options
context:
space:
mode:
authorremoitnane <remoit(DOT)nane(AT)gmail(DOT)com>2010-07-07 03:59:33 -0700
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2010-07-08 22:33:31 +0200
commit27efdd9a80c7d068f27db8725c2315fee3e10303 (patch)
tree2699a54961f6c29249c9d48747b8938b2d99dbd1 /src/net/manaserv
parentf1cab9c5ab1d36586ae1e0d1dae3f3d1483522b5 (diff)
downloadmana-27efdd9a80c7d068f27db8725c2315fee3e10303.tar.gz
mana-27efdd9a80c7d068f27db8725c2315fee3e10303.tar.bz2
mana-27efdd9a80c7d068f27db8725c2315fee3e10303.tar.xz
mana-27efdd9a80c7d068f27db8725c2315fee3e10303.zip
Fix crash in picking up an item that no longer exists
Adds ActorSpriteListener to manage ActorSprite destruction as recommended by Jaxad0127. This likewise includes the changes made by Bertram. Reviewed-by: Jaxad0127, Bertram. Resolves: Manasource Mantis #160
Diffstat (limited to 'src/net/manaserv')
-rw-r--r--src/net/manaserv/playerhandler.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index 60fa5b29..c2803ce1 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -329,11 +329,14 @@ void PlayerHandler::increaseSkill(int skillId)
void PlayerHandler::pickUp(FloorItem *floorItem)
{
- int id = floorItem->getId();
- MessageOut msg(PGMSG_PICKUP);
- msg.writeInt16(id >> 16);
- msg.writeInt16(id & 0xFFFF);
- gameServerConnection->send(msg);
+ if (floorItem)
+ {
+ int id = floorItem->getId();
+ MessageOut msg(PGMSG_PICKUP);
+ msg.writeInt16(id >> 16);
+ msg.writeInt16(id & 0xFFFF);
+ gameServerConnection->send(msg);
+ }
}
void PlayerHandler::setDirection(char direction)