summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/inventoryhandler.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 23a1e78b1..186f9ceb3 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -166,9 +166,12 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
case SMSG_PLAYER_STORAGE_ITEMS:
if (msg.getId() == SMSG_PLAYER_INVENTORY)
{
- // Clear inventory - this will be a complete refresh
- mEquips.clear();
- PlayerInfo::getEquipment()->setBackend(&mEquips);
+ if (PlayerInfo::getEquipment())
+ {
+ // Clear inventory - this will be a complete refresh
+ mEquips.clear();
+ PlayerInfo::getEquipment()->setBackend(&mEquips);
+ }
if (inventory)
inventory->clear();
@@ -255,6 +258,12 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
break;
case SMSG_PLAYER_INVENTORY_ADD:
+ if (PlayerInfo::getEquipment()
+ && !PlayerInfo::getEquipment()->getBackend())
+ { // look like SMSG_PLAYER_INVENTORY was not received
+ mEquips.clear();
+ PlayerInfo::getEquipment()->setBackend(&mEquips);
+ }
index = msg.readInt16() - INVENTORY_OFFSET;
amount = msg.readInt16();
itemId = msg.readInt16();
@@ -426,7 +435,8 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
case SMSG_PLAYER_EQUIPMENT:
msg.readInt16(); // length
- if (!PlayerInfo::getEquipment()->getBackend())
+ if (PlayerInfo::getEquipment()
+ && !PlayerInfo::getEquipment()->getBackend())
{ // look like SMSG_PLAYER_INVENTORY was not received
mEquips.clear();
PlayerInfo::getEquipment()->setBackend(&mEquips);