summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2020-06-01 04:30:21 +0200
committerGitHub <noreply@github.com>2020-06-01 04:30:21 +0200
commit99e79f945353d28f5af2fcc0242aac0fb5c0675e (patch)
tree6c6fe02c24b534b6d3c2ec23451d6fca072d92dd /src/map/unit.c
parentcd95e95a41a9d9f3cecd9efa0aaa52eb6f4ec7ea (diff)
parentb5dcf358a036ef024807b4060b48bb4a30967742 (diff)
downloadhercules-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()
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c5
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