summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-09-13 14:44:19 +0300
committerAndrei Karas <akaras@inbox.ru>2015-09-14 20:19:27 +0300
commit7b55511e79318e0b47b6a5dd3d6e309f9df2eb5e (patch)
tree6222359081fb79d34585f62eabec7e8853a62381 /src
parentbfc51d38a178286d20c42484a2cc0f9cfcf07f6b (diff)
downloadhercules-7b55511e79318e0b47b6a5dd3d6e309f9df2eb5e.tar.gz
hercules-7b55511e79318e0b47b6a5dd3d6e309f9df2eb5e.tar.bz2
hercules-7b55511e79318e0b47b6a5dd3d6e309f9df2eb5e.tar.xz
hercules-7b55511e79318e0b47b6a5dd3d6e309f9df2eb5e.zip
Add missing checks into buyingstore.c
Diffstat (limited to 'src')
-rw-r--r--src/map/buyingstore.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c
index a1b6e9e65..e01b8a1d8 100644
--- a/src/map/buyingstore.c
+++ b/src/map/buyingstore.c
@@ -14,6 +14,7 @@
#include "map/pc.h" // struct map_session_data
#include "common/cbasetypes.h"
#include "common/db.h" // ARR_FIND
+#include "common/nullpo.h" // nullpo_*
#include "common/showmsg.h" // ShowWarning
#include "common/socket.h" // RBUF*
#include "common/strlib.h" // safestrncpy
@@ -28,6 +29,7 @@ unsigned int buyingstore_getuid(void) {
bool buyingstore_setup(struct map_session_data* sd, unsigned char slots)
{
+ nullpo_retr(false, sd);
if( !battle_config.feature_buying_store || sd->state.vending || sd->state.buyingstore || sd->state.trading || slots == 0 )
{
return false;
@@ -62,11 +64,11 @@ bool buyingstore_setup(struct map_session_data* sd, unsigned char slots)
return true;
}
-
void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned char result, const char* storename, const uint8* itemlist, unsigned int count)
{
unsigned int i, weight, listidx;
+ nullpo_retv(sd);
if (!result || count == 0) {
// canceled, or no items
return;
@@ -178,10 +180,10 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha
clif->buyingstore_entry(sd);
}
-
void buyingstore_close(struct map_session_data* sd)
{
- if( sd->state.buyingstore )
+ nullpo_retv(sd);
+ if (sd->state.buyingstore)
{
// invalidate data
sd->state.buyingstore = false;
@@ -192,11 +194,11 @@ void buyingstore_close(struct map_session_data* sd)
}
}
-
void buyingstore_open(struct map_session_data* sd, int account_id)
{
struct map_session_data* pl_sd;
+ nullpo_retv(sd);
if( !battle_config.feature_buying_store || pc_istrading(sd) )
{// not allowed to sell
return;
@@ -229,6 +231,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int
unsigned int i, weight, listidx, k;
struct map_session_data* pl_sd;
+ nullpo_retv(sd);
if( count == 0 )
{// nothing to do
return;
@@ -402,7 +405,8 @@ bool buyingstore_search(struct map_session_data* sd, unsigned short nameid)
{
unsigned int i;
- if( !sd->state.buyingstore )
+ nullpo_retr(false, sd);
+ if (!sd->state.buyingstore)
{// not buying
return false;
}
@@ -424,6 +428,8 @@ bool buyingstore_searchall(struct map_session_data* sd, const struct s_search_st
unsigned int i, idx;
struct s_buyingstore_item* it;
+ nullpo_retr(true, sd);
+
if( !sd->state.buyingstore )
{// not buying
return true;