summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2014-09-20 16:28:03 -0300
committershennetsind <ind@henn.et>2014-09-20 16:28:03 -0300
commitda2d5dc8ad0d899ae7affed67801325d236cd8ca (patch)
tree8d202d368b09238f8063001a05e093ca4e2cb294 /src/map/skill.c
parent86d17badf325e9d87559a3a087d3c142a757cae9 (diff)
downloadhercules-da2d5dc8ad0d899ae7affed67801325d236cd8ca.tar.gz
hercules-da2d5dc8ad0d899ae7affed67801325d236cd8ca.tar.bz2
hercules-da2d5dc8ad0d899ae7affed67801325d236cd8ca.tar.xz
hercules-da2d5dc8ad0d899ae7affed67801325d236cd8ca.zip
Fixed Bug 8325
Code did not expect sd->equip_index to be empty ( -1 ), which'd cause a crash as reported. Special Thanks to Gerz! http://hercules.ws/board/tracker/issue-8325-another-map-server-crash-on-skill-shield-spell/ Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 393c88df2..db1296260 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -8696,8 +8696,8 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin
sc_start(src,bl,SC_SILENCE,100,skill_lv,sd->bonus.shieldmdef * 30000);
} else {
int opt = 0, val = 0, splashrange = 0;
- struct item_data *shield_data = sd->inventory_data[sd->equip_index[EQI_HAND_L]];
- if( !shield_data || shield_data->type != IT_ARMOR ) {
+ struct item_data *shield_data = NULL;
+ if( sd->equip_index[EQI_HAND_L] < 0 || !( shield_data = sd->inventory_data[sd->equip_index[EQI_HAND_L]] ) || shield_data->type != IT_ARMOR ) {
//Skill will first check if a shield is equipped. If none is found on the caster the skill will fail.
clif->skill_fail(sd,skill_id,USESKILL_FAIL_LEVEL,0);
break;