summaryrefslogtreecommitdiff
path: root/src/map/instance.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-01 01:00:46 +0300
committerAndrei Karas <akaras@inbox.ru>2015-12-04 18:50:06 +0300
commit9cd57f2a3ab76236bbb746a019b7eadae37aa29d (patch)
tree8a800376fc32c654622fa0f46403c9c7c9cd6b7b /src/map/instance.c
parentadb8f7f6cc63a110c8583aaee0d9f7039fbbbe2c (diff)
downloadhercules-9cd57f2a3ab76236bbb746a019b7eadae37aa29d.tar.gz
hercules-9cd57f2a3ab76236bbb746a019b7eadae37aa29d.tar.bz2
hercules-9cd57f2a3ab76236bbb746a019b7eadae37aa29d.tar.xz
hercules-9cd57f2a3ab76236bbb746a019b7eadae37aa29d.zip
Add missing checks to instance.c
Diffstat (limited to 'src/map/instance.c')
-rw-r--r--src/map/instance.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/map/instance.c b/src/map/instance.c
index 45e407dfc..0f6e475b2 100644
--- a/src/map/instance.c
+++ b/src/map/instance.c
@@ -61,6 +61,7 @@ int instance_create(int owner_id, const char *name, enum instance_owner_type typ
short *iptr = NULL;
int i;
+ nullpo_retr(-1, name);
switch ( type ) {
case IOT_NONE:
break;
@@ -158,6 +159,9 @@ int instance_add_map(const char *name, int instance_id, bool usebasename, const
int i, im = -1;
size_t num_cell, size, j;
+ nullpo_retr(-1, name);
+ nullpo_retr(-1, map_name);
+
if( m < 0 )
return -1; // source map not found
@@ -305,6 +309,7 @@ int instance_map2imap(int16 m, int instance_id) {
int instance_mapname2imap(const char *map_name, int instance_id) {
int i;
+ nullpo_retr(-1, map_name);
if( !instance->valid(instance_id) ) {
return -1;
}
@@ -322,6 +327,7 @@ int instance_mapname2imap(const char *map_name, int instance_id) {
* result : mapid of map "m" in this instance
*--------------------------------------*/
int instance_mapid2imapid(int16 m, int instance_id) {
+ Assert_retr(-1, m >= 0 && m < map->count);
if( map->list[m].flag.src4instance == 0 )
return m; // not instances found for this map
else if( map->list[m].instance_id >= 0 ) { // This map is a instance, not a src map instance
@@ -661,6 +667,7 @@ void instance_set_timeout(int instance_id, unsigned int progress_timeout, unsign
void instance_check_kick(struct map_session_data *sd) {
int16 m = sd->bl.m;
+ nullpo_retv(sd);
clif->instance_leave(sd->fd);
if( map->list[m].instance_id >= 0 ) { // User was on the instance map
if( map->list[m].save.map )