comparison arogue7/fight.c @ 132:66b0263af424

arogue7: prevent segfaults when backstabbing while empty-handed. The calculation of the backstabbing multiplier checked the current weapon's properties without making sure the current weapon pointer was not NULL.
author John "Elwin" Edwards
date Tue, 12 May 2015 18:57:30 -0400
parents b786053d2f37
children 1cd604c827a3
comparison
equal deleted inserted replaced
131:796e2a10cd41 132:66b0263af424
636 (weap && att != &pstats && on(*att_er, CANBSTAB))) { 636 (weap && att != &pstats && on(*att_er, CANBSTAB))) {
637 int mult = 2 + (att->s_lvl-1)/4; /* Normal multiplier */ 637 int mult = 2 + (att->s_lvl-1)/4; /* Normal multiplier */
638 638
639 if (mult > 5) 639 if (mult > 5)
640 mult = 5; 640 mult = 5;
641 if (weap->o_type == RELIC && weap->o_which == MUSTY_DAGGER) 641 if (weap && weap->o_type == RELIC &&
642 weap->o_which == MUSTY_DAGGER)
642 mult++; 643 mult++;
643 damage *= mult; 644 damage *= mult;
644 } 645 }
645 if (att == &pstats) { 646 if (att == &pstats) {
646 if (cur_weapon && (cur_weapon->o_flags & ISPOISON)) { 647 if (cur_weapon && (cur_weapon->o_flags & ISPOISON)) {