summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorpanikon <panikon@zoho.com>2014-06-17 16:54:26 -0300
committerpanikon <panikon@zoho.com>2014-06-17 16:54:26 -0300
commitaff9c142c8fdfc602b304825ca96b528ee4aa461 (patch)
treecc37373a786fb65a3d359e9154ceab72bb85158d /src/map
parent2fb3c8551e25f0a545612edf8a57f3311af71721 (diff)
downloadhercules-aff9c142c8fdfc602b304825ca96b528ee4aa461.tar.gz
hercules-aff9c142c8fdfc602b304825ca96b528ee4aa461.tar.bz2
hercules-aff9c142c8fdfc602b304825ca96b528ee4aa461.tar.xz
hercules-aff9c142c8fdfc602b304825ca96b528ee4aa461.zip
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/
Diffstat (limited to 'src/map')
-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;
}