From 17de8408fa79f286d65a4e35011c7524daf1202c Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sat, 22 Mar 2014 18:26:29 -0300 Subject: Fixed Bug 8109 elemental's action could cause itself to be destroyed (e.g. due to target's reflect) and would thus cause sd->ed to be null, and would cause a crash when trying to access sd->ed->db, so moving the duration check to prior to elemental's action trigger. Special Thanks to OmegaRed. http://hercules.ws/board/tracker/issue-8109-mapserver-crash-skill-so-el-action Signed-off-by: shennetsind --- src/map/skill.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/map/skill.c b/src/map/skill.c index 4e64f39f2..08a8f69db 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -9073,21 +9073,25 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin case SO_EL_ACTION: if( sd ) { int duration = 3000; - if( !sd->ed ) break; + if( !sd->ed ) + break; + + switch(sd->ed->db->class_){ + case 2115:case 2124: + case 2118:case 2121: + duration = 6000; + break; + case 2116:case 2119: + case 2122:case 2125: + duration = 9000; + break; + } + sd->skill_id_old = skill_id; elemental->action(sd->ed, bl, tick); clif->skill_nodamage(src,bl,skill_id,skill_lv,1); - switch(sd->ed->db->class_){ - case 2115:case 2124: - case 2118:case 2121: - duration = 6000; - break; - case 2116:case 2119: - case 2122:case 2125: - duration = 9000; - break; - } - skill->blockpc_start(sd, skill_id, duration); + + skill->blockpc_start(sd, skill_id, duration); } break; -- cgit v1.2.3-70-g09d2