summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-25 23:58:16 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-25 23:58:16 +0300
commit482782d74c61e226ed1ce81700708244565291f5 (patch)
treec955925952f091cdc71af8b1e7f8b3cdabecfa6b
parentee12c6e77bd4d34d5fa682361127add32cc1a184 (diff)
downloadManaVerse-482782d74c61e226ed1ce81700708244565291f5.tar.gz
ManaVerse-482782d74c61e226ed1ce81700708244565291f5.tar.bz2
ManaVerse-482782d74c61e226ed1ce81700708244565291f5.tar.xz
ManaVerse-482782d74c61e226ed1ce81700708244565291f5.zip
Add missing checks into net directory.
-rw-r--r--src/net/ea/inventoryitem.h2
-rw-r--r--src/net/eathena/auctionhandler.cpp2
-rw-r--r--src/net/eathena/beinghandler.cpp33
-rw-r--r--src/net/eathena/beinghandler.h6
-rw-r--r--src/net/eathena/buyingstorehandler.cpp2
-rw-r--r--src/net/eathena/inventoryhandler.cpp4
-rw-r--r--src/net/tmwa/beinghandler.cpp6
-rw-r--r--src/net/tmwa/beinghandler.h2
8 files changed, 19 insertions, 38 deletions
diff --git a/src/net/ea/inventoryitem.h b/src/net/ea/inventoryitem.h
index dd6f64b10..b318b2f23 100644
--- a/src/net/ea/inventoryitem.h
+++ b/src/net/ea/inventoryitem.h
@@ -79,6 +79,8 @@ class InventoryItem final
favorite(favorite0),
equip(equip0)
{
+ if (!cards0)
+ return;
for (int f = 0; f < 4; f ++)
cards[f] = cards0[f];
}
diff --git a/src/net/eathena/auctionhandler.cpp b/src/net/eathena/auctionhandler.cpp
index 586e276b8..7522ec491 100644
--- a/src/net/eathena/auctionhandler.cpp
+++ b/src/net/eathena/auctionhandler.cpp
@@ -139,6 +139,8 @@ void AuctionHandler::cancelReg() const
void AuctionHandler::setItem(const Item *const item,
const int amount) const
{
+ if (!item)
+ return;
createOutPacket(CMSG_AUCTION_SET_ITEM);
outMsg.writeInt16(static_cast<int16_t>(
item->getInvIndex() + INVENTORY_OFFSET), "index");
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 10161d922..26e78cd84 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -479,6 +479,8 @@ Being *BeingHandler::createBeing2(Net::MessageIn &msg,
void BeingHandler::undress(Being *const being) const
{
+ if (!being)
+ return;
being->setSprite(SPRITE_WEAPON, 0);
being->setSprite(SPRITE_HEAD_BOTTOM, 0);
being->setSprite(SPRITE_CLOTHES_COLOR, 0);
@@ -1507,37 +1509,6 @@ void BeingHandler::processBeingSoundEffect(Net::MessageIn &msg)
msg.readInt32("source being id");
}
-void BeingHandler::applyPlayerAction(Net::MessageIn &msg,
- Being *const being,
- const uint8_t type)
-{
- switch (type)
- {
- case 0:
- being->setAction(BeingAction::STAND, 0);
- localPlayer->imitateAction(being, BeingAction::STAND);
- break;
-
- case 1:
- if (being->getCurrentAction() != BeingAction::DEAD)
- {
- being->setAction(BeingAction::DEAD, 0);
- being->recalcSpritesOrder();
- }
- break;
-
- case 2:
- being->setAction(BeingAction::SIT, 0);
- localPlayer->imitateAction(being, BeingAction::SIT);
- break;
-
- default:
- // need set stand state?
- UNIMPLIMENTEDPACKET;
- break;
- }
-}
-
void BeingHandler::viewPlayerEquipment(const Being *const being)
{
if (!being)
diff --git a/src/net/eathena/beinghandler.h b/src/net/eathena/beinghandler.h
index ba8cf5ce7..cb8707218 100644
--- a/src/net/eathena/beinghandler.h
+++ b/src/net/eathena/beinghandler.h
@@ -86,7 +86,7 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler
Being *const dstBeing,
const uint8_t type,
const int id,
- const int id2);
+ const int id2) A_NONNULL(2);
static void processBeingSpecialEffect(Net::MessageIn &msg);
@@ -94,10 +94,6 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler
static void processBeingSoundEffect(Net::MessageIn &msg);
- static void applyPlayerAction(Net::MessageIn &msg,
- Being *const being,
- const uint8_t type);
-
void viewPlayerEquipment(const Being *const being);
static void processSkillGroundNoDamage(Net::MessageIn &msg);
diff --git a/src/net/eathena/buyingstorehandler.cpp b/src/net/eathena/buyingstorehandler.cpp
index 9a9bfe728..f317cd712 100644
--- a/src/net/eathena/buyingstorehandler.cpp
+++ b/src/net/eathena/buyingstorehandler.cpp
@@ -327,7 +327,7 @@ void BuyingStoreHandler::sell(const Being *const being,
const Item *const item,
const int amount) const
{
- if (!being)
+ if (!being || !item)
return;
createOutPacket(CMSG_BUYINGSTORE_SELL);
diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp
index 8406575bd..0e90235f6 100644
--- a/src/net/eathena/inventoryhandler.cpp
+++ b/src/net/eathena/inventoryhandler.cpp
@@ -406,6 +406,8 @@ void InventoryHandler::insertCard(const int cardIndex,
void InventoryHandler::favoriteItem(const Item *const item,
const bool favorite) const
{
+ if (!item)
+ return;
createOutPacket(CMSG_PLAYER_FAVORITE_ITEM);
outMsg.writeInt16(static_cast<int16_t>(item->getInvIndex()
+ INVENTORY_OFFSET),
@@ -802,6 +804,8 @@ void InventoryHandler::processPlayerInsertCard(Net::MessageIn &msg)
void InventoryHandler::selectEgg(const Item *const item) const
{
+ if (!item)
+ return;
createOutPacket(CMSG_PET_SELECT_EGG);
outMsg.writeInt16(static_cast<int16_t>(
item->getInvIndex() + INVENTORY_OFFSET), "index");
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 28c91fd28..8092a519f 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -238,6 +238,8 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
void BeingHandler::undress(Being *const being) const
{
+ if (!being)
+ return;
being->setSprite(SPRITE_WEAPON, 0);
being->setSprite(SPRITE_HEAD_BOTTOM, 0);
being->setSprite(SPRITE_CLOTHES_COLOR, 0);
@@ -1355,6 +1357,8 @@ void BeingHandler::processBeingChangeDirection(Net::MessageIn &msg)
void BeingHandler::setServerGender(Being *const being, const uint8_t gender)
{
+ if (!being)
+ return;
switch (gender)
{
case 2:
@@ -1376,6 +1380,8 @@ void BeingHandler::applyPlayerAction(Net::MessageIn &msg,
Being *const being,
const uint8_t type)
{
+ if (!being)
+ return;
switch (type)
{
case 0:
diff --git a/src/net/tmwa/beinghandler.h b/src/net/tmwa/beinghandler.h
index 7d78b5d33..1b722415d 100644
--- a/src/net/tmwa/beinghandler.h
+++ b/src/net/tmwa/beinghandler.h
@@ -78,7 +78,7 @@ class BeingHandler final : public MessageHandler, public Ea::BeingHandler
Being *const dstBeing,
const uint8_t type,
const int id,
- const int id2);
+ const int id2) A_NONNULL(2);
static void processPlaterStatusChange(Net::MessageIn &msg);