From e4d264681d98223501e005e23222b5b51cf57e5b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 31 Jul 2005 07:42:13 +0000 Subject: [PATCH] =?UTF-8?q?null-pointer=20check=20neuer=20r=C3=BCstungscod?= =?UTF-8?q?e.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/kernel/battle.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index d70e26c05..dc661aaaa 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -965,8 +965,8 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile) sd = weapon_effskill(dt, at, weapon, false, false); if (weapon!=NULL) dwtype=weapon->type; - ar = armor->prot; - ar += shield->prot; + if (armor) ar = armor->prot; + if (shield) ar += shield->prot; /* natürliche Rüstung */ an = du->race->armor; @@ -1054,8 +1054,8 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile) if (dwp == WP_RUNESWORD) res -= 0.80; #endif /* der Effekt von Laen steigt nicht linear */ - if (fval(armor, ATF_LAEN)) res *= (1-armor->magres); - if (fval(shield, ATF_LAEN)) res *= (1-shield->magres); + if (armor && fval(armor, ATF_LAEN)) res *= (1-armor->magres); + if (shield && fval(shield, ATF_LAEN)) res *= (1-shield->magres); if (dwtype) res *= (1-dwtype->magres); }