From 65b98bffd739778583e4c66f50e6e82f023a2a67 Mon Sep 17 00:00:00 2001 From: Haru Date: Wed, 18 Nov 2015 10:43:18 +0100 Subject: Fixed a crash in some skills' multi-hit code - The crash could happen when Land Protector is cast as result of a Fire Wall hit. - Fixes #698 (fix based on ultramage's suggestion) - The fix was also applied to the Taekwon Master's Warmth skills that, while not affected by Land Protector, use a very similar multi-hit loop. Signed-off-by: Haru --- src/map/skill.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/map/skill.c') diff --git a/src/map/skill.c b/src/map/skill.c index cdf1c031f..8984bf0fa 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -11878,8 +11878,8 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 //Take into account these hit more times than the timer interval can handle. do skill->attack(BF_MAGIC,ss,&src->bl,bl,sg->skill_id,sg->skill_lv,tick+count*sg->interval,0); - while(--src->val2 && x == bl->x && y == bl->y - && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl)); + while (src->alive != 0 && --src->val2 != 0 && x == bl->x && y == bl->y + && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl)); if (src->val2<=0) skill->delunit(src); @@ -11961,8 +11961,8 @@ int skill_unit_onplace_timer(struct skill_unit *src, struct block_list *bl, int6 sg->limit = DIFF_TICK32(tick,sg->tick); break; } - } while( x == bl->x && y == bl->y && sg->alive_count - && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl) ); + } while (src->alive != 0 && x == bl->x && y == bl->y && sg->alive_count != 0 + && ++count < SKILLUNITTIMER_INTERVAL/sg->interval && !status->isdead(bl)); map->freeblock_unlock(); } break; -- cgit v1.2.3-60-g2f50