From aff9c142c8fdfc602b304825ca96b528ee4aa461 Mon Sep 17 00:00:00 2001 From: panikon Date: Tue, 17 Jun 2014 16:54:26 -0300 Subject: Fixed issue where a crash would occur in mobs with MD_RANDOMTARGET, issue: 8231 http://hercules.ws/board/tracker/issue-8231-server-received-crash-signal/ --- src/map/mob.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/map') 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; } -- cgit v1.2.3-70-g09d2