diff options
author | skyleo <skyleo@skyleo.de> | 2019-10-03 01:25:04 +0200 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2020-03-08 20:59:25 +0100 |
commit | 193956af55b94852917fc236a431ae384bf78d84 (patch) | |
tree | d41d600ae2b2c8ef73c0c6c793ff660d7a5ab13e /src/map/unit.c | |
parent | 38108320a6ab0a27d9deba967f553b2a6f8b9537 (diff) | |
download | hercules-193956af55b94852917fc236a431ae384bf78d84.tar.gz hercules-193956af55b94852917fc236a431ae384bf78d84.tar.bz2 hercules-193956af55b94852917fc236a431ae384bf78d84.tar.xz hercules-193956af55b94852917fc236a431ae384bf78d84.zip |
Add nullpo_retr for unit_data in unit->walktobl_sub
Diffstat (limited to 'src/map/unit.c')
-rw-r--r-- | src/map/unit.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index 5d3011aba..64a849384 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -618,9 +618,13 @@ static inline void set_mobstate(struct block_list *bl, int flag) static int unit_walktobl_sub(int tid, int64 tick, int id, intptr_t data) { struct block_list *bl = map->id2bl(id); - struct unit_data *ud = bl?unit->bl2ud(bl):NULL; + if (bl == NULL) + return 1; + struct unit_data *ud = unit->bl2ud(bl); + if (ud == NULL) + return 1; - if (ud && ud->walktimer == INVALID_TIMER && ud->target == data) { + if (ud->walktimer == INVALID_TIMER && ud->target == data) { if (DIFF_TICK(ud->canmove_tick, tick) > 0) //Keep waiting? timer->add(ud->canmove_tick+1, unit->walktobl_sub, id, data); else if (unit->can_move(bl)) { |