From 2a396943739c09664d7d2bfcf074d7a1fa0d42ed Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 8 Apr 2018 13:33:16 +0200 Subject: Prevent a null pointer failure when TK_JUMPKICK is used by a non-player Fixes #1875 Signed-off-by: Haru --- src/map/skill.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/map/skill.c b/src/map/skill.c index 3d541bf76..9108b6575 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -6503,16 +6503,14 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case TK_JUMPKICK: /* Check if the target is an enemy; if not, skill should fail so the character doesn't unit->movepos (exploitable) */ - if( battle->check_target(src, bl, BCT_ENEMY) > 0 ) - { - if( unit->movepos(src, bl->x, bl->y, 1, 1) ) - { - skill->attack(BF_WEAPON,src,src,bl,skill_id,skill_lv,tick,flag); - clif->slide(src,bl->x,bl->y); + if (battle->check_target(src, bl, BCT_ENEMY) > 0) { + if (unit->movepos(src, bl->x, bl->y, 1, 1)) { + skill->attack(BF_WEAPON, src, src, bl, skill_id, skill_lv, tick, flag); + clif->slide(src, bl->x, bl->y); } + } else if (sd != NULL) { + clif->skill_fail(sd, skill_id, USESKILL_FAIL, 0); } - else - clif->skill_fail(sd,skill_id,USESKILL_FAIL,0); break; case AL_INCAGI: -- cgit v1.2.3-60-g2f50