fix a crash in write_game caused by remove_empty_factions

https://bugs.eressea.de/view.php?id=2201
This commit is contained in:
Enno Rehling 2016-04-03 12:23:51 +02:00
parent bc8c39f4bb
commit 30b3cff657
2 changed files with 2 additions and 7 deletions

View File

@ -1,3 +1,3 @@
#define VERSION_MAJOR 3 #define VERSION_MAJOR 3
#define VERSION_MINOR 8 #define VERSION_MINOR 8
#define VERSION_BUILD 7 #define VERSION_BUILD 8

View File

@ -74,9 +74,6 @@ faction *factions;
static void free_faction(faction * f) static void free_faction(faction * f)
{ {
funhash(f); funhash(f);
if (f->alliance && f->alliance->_leader == f) {
setalliance(f, 0);
}
if (f->msgs) { if (f->msgs) {
free_messagelist(f->msgs->begin); free_messagelist(f->msgs->begin);
free(f->msgs); free(f->msgs);
@ -454,7 +451,7 @@ void destroyfaction(faction ** fp)
} }
#endif #endif
if (f->alliance && f->alliance->_leader == f) { if (f->alliance) {
setalliance(f, 0); setalliance(f, 0);
} }
@ -681,8 +678,6 @@ void remove_empty_factions(void)
if (!(f->_alive && f->units!=NULL) && !fval(f, FFL_NOIDLEOUT)) { if (!(f->_alive && f->units!=NULL) && !fval(f, FFL_NOIDLEOUT)) {
log_debug("dead: %s", factionname(f)); log_debug("dead: %s", factionname(f));
destroyfaction(fp); destroyfaction(fp);
free_faction(f);
free(f);
} }
else { else {
fp = &(*fp)->next; fp = &(*fp)->next;