summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 552724de0..6bfe3abb9 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -1627,8 +1627,11 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) {
int search_size = (view_range < md->status.rhw.range) ? view_range : md->status.rhw.range;
unit->attack(&md->bl,tbl->id,0);
tbl = battle->get_enemy(&md->bl, DEFAULT_ENEMY_TYPE(md), search_size);
- md->target_id = tbl->id;
- md->min_chase = md->db->range3;
+ // If no target was found, keep atacking the old one
+ if( tbl ) {
+ md->target_id = tbl->id;
+ md->min_chase = md->db->range3;
+ }
}
return true;
}