summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-06 23:56:48 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-06 23:58:33 +0300
commit0772dd0f128aaeb46cb00ccf9ee00721bab90144 (patch)
tree5828ae06cdcc11f9a251c69107a236a34f9dbedf
parentf0fb75952afc17ee33718f02f1d939e44f15b82d (diff)
downloadhercules-0772dd0f128aaeb46cb00ccf9ee00721bab90144.tar.gz
hercules-0772dd0f128aaeb46cb00ccf9ee00721bab90144.tar.bz2
hercules-0772dd0f128aaeb46cb00ccf9ee00721bab90144.tar.xz
hercules-0772dd0f128aaeb46cb00ccf9ee00721bab90144.zip
Fix null pointer access after previous commits.
-rw-r--r--src/map/map.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/map/map.c b/src/map/map.c
index ed171f4bd..1b922148b 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -1921,7 +1921,8 @@ struct map_session_data *map_id2sd(int id)
bl = idb_get(map->pc_db,id);
- Assert_retr(NULL, bl->type == BL_PC);
+ if (bl)
+ Assert_retr(NULL, bl->type == BL_PC);
return BL_UCAST(BL_PC, bl);
}
@@ -1957,7 +1958,8 @@ struct mob_data *map_id2md(int id)
bl = idb_get(map->mobid_db,id);
- Assert_retr(NULL, bl->type == BL_MOB);
+ if (bl)
+ Assert_retr(NULL, bl->type == BL_MOB);
return BL_UCAST(BL_MOB, bl);
}
@@ -2106,7 +2108,8 @@ const char *map_charid2nick(int charid) {
struct map_session_data* map_charid2sd(int charid)
{
struct block_list *bl = idb_get(map->charid_db, charid);
- Assert_retr(NULL, bl->type == BL_PC);
+ if (bl)
+ Assert_retr(NULL, bl->type == BL_PC);
return BL_UCAST(BL_PC, bl);
}
@@ -2187,7 +2190,8 @@ struct mob_data *map_id2boss(int id)
if (id <= 0)
return NULL;
bl = idb_get(map->bossid_db,id);
- Assert_retr(NULL, bl->type == BL_MOB);
+ if (bl)
+ Assert_retr(NULL, bl->type == BL_MOB);
return BL_UCAST(BL_MOB, bl);
}