diff options
author | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-05-14 23:31:12 +0200 |
---|---|---|
committer | Kenpachi Developer <Kenpachi.Developer@gmx.de> | 2020-05-14 23:43:28 +0200 |
commit | b5dcf358a036ef024807b4060b48bb4a30967742 (patch) | |
tree | 285b3396db5389234978ab0b2ea7683afe619f77 /src/map/unit.c | |
parent | 3d9317d3a0bb200b9262be8fb882f33b40bfbd2e (diff) | |
download | hercules-b5dcf358a036ef024807b4060b48bb4a30967742.tar.gz hercules-b5dcf358a036ef024807b4060b48bb4a30967742.tar.bz2 hercules-b5dcf358a036ef024807b4060b48bb4a30967742.tar.xz hercules-b5dcf358a036ef024807b4060b48bb4a30967742.zip |
Replace NULL pointer report with returning error code in unit_steptimer()
Diffstat (limited to 'src/map/unit.c')
-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 19f09f83c..3965be852 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 |