diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-07-21 00:47:44 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-07-21 00:47:44 +0300 |
commit | fffbd86a1014ad169ed2d68ea58cdddf346faa14 (patch) | |
tree | 713c96fcf7421ca87f638d312e752179281cb8fe /src/net/eathena | |
parent | 1941b81a5a278f26a5d7e1f91903ab04c92e2cd1 (diff) | |
download | manaplus-fffbd86a1014ad169ed2d68ea58cdddf346faa14.tar.gz manaplus-fffbd86a1014ad169ed2d68ea58cdddf346faa14.tar.bz2 manaplus-fffbd86a1014ad169ed2d68ea58cdddf346faa14.tar.xz manaplus-fffbd86a1014ad169ed2d68ea58cdddf346faa14.zip |
Add missing checks and non null attributes.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 7 | ||||
-rw-r--r-- | src/net/eathena/buyingstorehandler.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/inventoryhandler.cpp | 4 |
3 files changed, 10 insertions, 3 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 79fddcf18..d12941fcd 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -663,7 +663,6 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) return; dstBeing = createBeing2(msg, id, job, type); - if (!dstBeing) return; } @@ -831,7 +830,6 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) return; dstBeing = createBeing2(msg, id, job, type); - if (!dstBeing) return; } @@ -1001,7 +999,6 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) return; dstBeing = createBeing2(msg, id, job, type); - if (!dstBeing) return; } @@ -1120,6 +1117,8 @@ void BeingHandler::processMapTypeProperty(Net::MessageIn &msg) MapTypeProperty2 props; props.data = static_cast<uint32_t>(flags); Game *const game = Game::instance(); + if (!game) + return; Map *const map = game->getCurrentMap(); if (!map) return; @@ -1679,6 +1678,8 @@ void BeingHandler::processBeingFakeName(Net::MessageIn &msg) msg.skip(4, "unsued"); Being *const dstBeing = createBeing2(msg, id, job, type); + if (!dstBeing) + return; dstBeing->setSubtype(fromInt(job, BeingTypeId), 0); dstBeing->setTileCoords(x, y); dstBeing->setDirection(dir); diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp index f2017bd53..d42d66b07 100644 --- a/src/net/eathena/buyingstorehandler.cpp +++ b/src/net/eathena/buyingstorehandler.cpp @@ -208,6 +208,8 @@ void BuyingStoreHandler::processBuyingStoreItemsList(Net::MessageIn &msg) const int itemType = msg.readUInt8("item type"); const int itemId = msg.readInt16("item id"); + if (!inv) + continue; const Item *const item = inv->findItem(itemId, 1); if (!item) continue; diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index 015ff3c2c..86faea2e7 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -803,6 +803,8 @@ void InventoryHandler::processPlayerUseCard(Net::MessageIn &msg) for (int f = 0; f < count; f ++) { const int itemIndex = msg.readInt16("item index") - INVENTORY_OFFSET; + if (!inv) + continue; const Item *const item = inv->getItem(itemIndex); if (!item) continue; @@ -822,6 +824,8 @@ void InventoryHandler::processPlayerInsertCard(Net::MessageIn &msg) { NotifyManager::notify(NotifyTypes::CARD_INSERT_SUCCESS); Inventory *const inv = PlayerInfo::getInventory(); + if (!inv) + return; Item *const card = inv->getItem(cardIndex); int cardId = 0; if (card) |