forked from github/server
general check for sf->faction's validity
The handling of an ally without a valid faction-pointer is now skipped in favor of a logged error.
This commit is contained in:
parent
2f02c27659
commit
f18b5ea7d2
1 changed files with 10 additions and 5 deletions
|
@ -1346,13 +1346,18 @@ void writefaction(struct gamedata *data, const faction * f)
|
||||||
WRITE_SECTION(data->store);
|
WRITE_SECTION(data->store);
|
||||||
|
|
||||||
for (sf = f->allies; sf; sf = sf->next) {
|
for (sf = f->allies; sf; sf = sf->next) {
|
||||||
int no = (sf->faction != NULL) ? sf->faction->no : 0;
|
if (sf->faction != NULL) {
|
||||||
|
int no = sf->faction->no;
|
||||||
int status = alliedfaction(NULL, f, sf->faction, HELP_ALL);
|
int status = alliedfaction(NULL, f, sf->faction, HELP_ALL);
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
WRITE_INT(data->store, no);
|
WRITE_INT(data->store, no);
|
||||||
WRITE_INT(data->store, sf->status);
|
WRITE_INT(data->store, sf->status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
log_error("NULL-pointer in ally-struct for faction '%s'.", f->no);
|
||||||
|
}
|
||||||
|
}
|
||||||
WRITE_INT(data->store, 0);
|
WRITE_INT(data->store, 0);
|
||||||
WRITE_SECTION(data->store);
|
WRITE_SECTION(data->store);
|
||||||
write_groups(data->store, f);
|
write_groups(data->store, f);
|
||||||
|
|
Loading…
Reference in a new issue