summaryrefslogtreecommitdiff
path: root/src/emap/pc.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-30 21:10:18 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-30 21:10:18 +0300
commit2c9c1e2eb8e74a6f8d9765993365648555ddf9b0 (patch)
treeb2f83e8dda892954898205526bd0d4796ba52641 /src/emap/pc.c
parentb826af28255cbd69318929aeb06b4164feed5588 (diff)
downloadplugin-2c9c1e2eb8e74a6f8d9765993365648555ddf9b0.tar.gz
plugin-2c9c1e2eb8e74a6f8d9765993365648555ddf9b0.tar.bz2
plugin-2c9c1e2eb8e74a6f8d9765993365648555ddf9b0.tar.xz
plugin-2c9c1e2eb8e74a6f8d9765993365648555ddf9b0.zip
Add missing checks.
Diffstat (limited to 'src/emap/pc.c')
-rw-r--r--src/emap/pc.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/emap/pc.c b/src/emap/pc.c
index 1c7c74e..c7203d0 100644
--- a/src/emap/pc.c
+++ b/src/emap/pc.c
@@ -94,7 +94,7 @@ void epc_equipitem_pos(TBL_PC *sd, struct item_data *id, int *nPtr, int *posPtr)
hookStop();
- if (!id)
+ if (!id || !sd)
return;
if (pos & (EQP_HAND_R|EQP_SHADOW_WEAPON))
@@ -445,6 +445,8 @@ bool epc_can_insert_card_into_post(bool retVal, struct map_session_data* sd,
int f;
if (retVal)
{
+ if (!sd)
+ return retVal;
struct ItemdExt *data = itemd_get(sd->inventory_data[*idx_equip]);
if (!data || !data->allowedCards[0].id) // allow cards if AllowedCards list is empty
return retVal;
@@ -484,7 +486,7 @@ static int tempAmount = 0;
int epc_dropitem_pre(struct map_session_data *sd, int *nPtr, int *amountPtr)
{
const int n = *nPtr;
- if (n < 0 || n >= MAX_INVENTORY)
+ if (!sd || n < 0 || n >= MAX_INVENTORY)
{
tempN = 0;
tempId = 0;
@@ -542,8 +544,11 @@ int epc_takeitem_post(int retVal, struct map_session_data *sd, struct flooritem_
int epc_insert_card_pre(struct map_session_data* sd, int *idx_card, int *idx_equip)
{
- if (!sd || *idx_equip < 0 || *idx_equip >= MAX_INVENTORY ||
- *idx_card < 0 || *idx_card >= MAX_INVENTORY)
+ if (!sd ||
+ *idx_equip < 0 ||
+ *idx_equip >= MAX_INVENTORY ||
+ *idx_card < 0 ||
+ *idx_card >= MAX_INVENTORY)
{
tempN = 0;
tempId = 0;