diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c index 129bd49fd..2ea2bfc6b 100644 --- a/src/eressea/korrektur.c +++ b/src/eressea/korrektur.c @@ -23,6 +23,7 @@ /* misc includes */ #include +#include #include /* 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);