Fixes an fix_otherfaction (null-pointer)

This commit is contained in:
Enno Rehling 2005-02-06 08:23:28 +00:00
parent 05f6eec60d
commit d221ca4db7
1 changed files with 9 additions and 7 deletions

View File

@ -23,6 +23,7 @@
/* misc includes */
#include <attributes/key.h>
#include <attributes/otherfaction.h>
#include <modules/xecmd.h>
/* gamecode includes */
@ -491,15 +492,16 @@ fix_otherfaction(void)
unit * u;
for (u=r->units;u;u=u->next) {
attrib * a = a_find(u->attribs, &at_otherfaction);
faction * f = (faction*)a->data.v;
if (f==u->faction) {
a_remove(&u->attribs, a);
++ncount;
}
if (a!=NULL) {
faction * f = (faction*)a->data.v;
if (f==u->faction) {
a_remove(&u->attribs, a);
++count;
}
}
}
r = r->next;
}
if (count) log_warning(("%u units had otherfaction=own faction.\n"));
if (count) log_warning(("%u units had otherfaction=own faction.\n", count));
}
extern attrib * make_atgmcreate(const struct item_type * itype);