Bugfix: Crash if not all fighters have a firesword

This commit is contained in:
Enno Rehling 2003-09-21 07:52:23 +00:00
parent af9422a0df
commit 13ef5bdb07

View file

@ -186,7 +186,8 @@ attack_firesword(const troop * at, int *casualties, int row)
if (fi->catmsg == -1) { if (fi->catmsg == -1) {
int i, k=0; int i, k=0;
for (i=0;i<=at->index;++i) { 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), sprintf(buf, "%d Kämpfer aus %s benutz%s Flammenschwert%s:", k, unitname(fi->unit),
(k==1)?"t sein ":"en ihre",(k==1)?"":"er"); (k==1)?"t sein ":"en ihre",(k==1)?"":"er");