summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-20 21:38:51 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-04 18:50:06 +0300
commit99cb5b4ae5d703878c421d3dd62ef626a7979130 (patch)
tree6a0156620be7e62f3e9b1ed2f9d6cd3c9d0c4e90 /src
parentc5656c0948e8bc1980bdb643fc1145655ecaf170 (diff)
downloadhercules-99cb5b4ae5d703878c421d3dd62ef626a7979130.tar.gz
hercules-99cb5b4ae5d703878c421d3dd62ef626a7979130.tar.bz2
hercules-99cb5b4ae5d703878c421d3dd62ef626a7979130.tar.xz
hercules-99cb5b4ae5d703878c421d3dd62ef626a7979130.zip
Add missing check to mail.c
Diffstat (limited to 'src')
-rw-r--r--src/map/mail.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/map/mail.c b/src/map/mail.c
index e952d9b63..8abeed285 100644
--- a/src/map/mail.c
+++ b/src/map/mail.c
@@ -23,6 +23,7 @@ struct mail_interface *mail;
void mail_clear(struct map_session_data *sd)
{
+ nullpo_retv(sd);
sd->mail.nameid = 0;
sd->mail.index = 0;
sd->mail.amount = 0;
@@ -64,6 +65,7 @@ int mail_removezeny(struct map_session_data *sd, short flag)
unsigned char mail_setitem(struct map_session_data *sd, int idx, int amount) {
+ nullpo_retr(1, sd);
if( pc_istrading(sd) )
return 1;
@@ -109,6 +111,7 @@ bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg)
return false;
n = sd->mail.index;
+ Assert_retr(false, n >= 0 && n < MAX_INVENTORY);
if( sd->mail.amount )
{
if( sd->status.inventory[n].nameid != sd->mail.nameid )
@@ -139,6 +142,8 @@ bool mail_setattachment(struct map_session_data *sd, struct mail_message *msg)
void mail_getattachment(struct map_session_data* sd, int zeny, struct item* item)
{
+ nullpo_retv(sd);
+ nullpo_retv(item);
if( item->nameid > 0 && item->amount > 0 )
{
pc->additem(sd, item, item->amount, LOG_TYPE_MAIL);
@@ -184,6 +189,7 @@ void mail_deliveryfail(struct map_session_data *sd, struct mail_message *msg)
// This function only check if the mail operations are valid
bool mail_invalid_operation(struct map_session_data *sd) {
+ nullpo_retr(false, sd);
if( !map->list[sd->bl.m].flag.town && !pc->can_use_command(sd, "@mail") ) {
ShowWarning("clif->parse_Mail: char '%s' trying to do invalid mail operations.\n", sd->status.name);
return true;