fix crash in tests when no monsters exist

This commit is contained in:
Enno Rehling 2010-01-10 02:55:23 +00:00
parent 1907f832ef
commit be015da263
2 changed files with 6 additions and 4 deletions

View File

@ -38,7 +38,7 @@ extern "C" {
#define FLEE_ROW 4 #define FLEE_ROW 4
#define LAST_ROW (NUMROWS-1) #define LAST_ROW (NUMROWS-1)
#define FIRST_ROW FIGHT_ROW #define FIRST_ROW FIGHT_ROW
#define MAXSIDES 128 /* if there are ever more than this, we're fucked. */ #define MAXSIDES 192 /* if there are ever more than this, we're fucked. */
struct message; struct message;

View File

@ -1645,11 +1645,13 @@ static void
clear_monster_orders(void) clear_monster_orders(void)
{ {
faction * f = get_monsters(); faction * f = get_monsters();
if (f) {
unit * u; unit * u;
for (u=f->units;u;u=u->nextF) { for (u=f->units;u;u=u->nextF) {
free_orders(&u->orders); free_orders(&u->orders);
} }
} }
}
int int
writegame(const char *filename, int mode) writegame(const char *filename, int mode)