diff options
author | Haru <haru@dotalux.com> | 2020-06-01 04:30:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 04:30:21 +0200 |
commit | 99e79f945353d28f5af2fcc0242aac0fb5c0675e (patch) | |
tree | 6c6fe02c24b534b6d3c2ec23451d6fca072d92dd | |
parent | cd95e95a41a9d9f3cecd9efa0aaa52eb6f4ec7ea (diff) | |
parent | b5dcf358a036ef024807b4060b48bb4a30967742 (diff) | |
download | hercules-99e79f945353d28f5af2fcc0242aac0fb5c0675e.tar.gz hercules-99e79f945353d28f5af2fcc0242aac0fb5c0675e.tar.bz2 hercules-99e79f945353d28f5af2fcc0242aac0fb5c0675e.tar.xz hercules-99e79f945353d28f5af2fcc0242aac0fb5c0675e.zip |
Merge pull request #2723 from Kenpachi2k13/nullpo_unit_steptimer
Replace NULL pointer report with returning error code in unit_steptimer()
-rw-r--r-- | src/map/unit.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index a6afb5ee7..c23e96aee 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -270,9 +270,8 @@ static int unit_steptimer(int tid, int64 tick, int id, intptr_t data) } else { // If a player has target_id set and target is in range, attempt attack struct block_list *tbl = map->id2bl(target_id); - nullpo_retr(2, tbl); - if (status->check_visibility(bl, tbl) == 0) // Target not visible - return 1; + if (tbl == NULL || status->check_visibility(bl, tbl) == 0) + return 1; // Target does not exist (player offline, monster died, etc.) or target is not visible to source. if (ud->stepskill_id == 0) unit->attack(bl, tbl->id, ud->state.attack_continue + 2); // Execute normal attack else |