From 13ef5bdb079f3b64fa27ec7b9fa3f9cdeb2eb172 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 21 Sep 2003 07:52:23 +0000 Subject: [PATCH] Bugfix: Crash if not all fighters have a firesword --- src/common/items/weapons.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/common/items/weapons.c b/src/common/items/weapons.c index 48f9328ea..e92ab25e2 100644 --- a/src/common/items/weapons.c +++ b/src/common/items/weapons.c @@ -186,7 +186,8 @@ attack_firesword(const troop * at, int *casualties, int row) if (fi->catmsg == -1) { int i, k=0; for (i=0;i<=at->index;++i) { - if (fi->person[i].melee->type == oldweapontype[WP_FIRESWORD]) ++k; + struct weapon * wp = fi->person[i].melee; + if (wp!=NULL && wp->type == oldweapontype[WP_FIRESWORD]) ++k; } sprintf(buf, "%d Kämpfer aus %s benutz%s Flammenschwert%s:", k, unitname(fi->unit), (k==1)?"t sein ":"en ihre",(k==1)?"":"er");