From af616b5b09e98dc9cd08b5df394829025572d7c3 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 31 Oct 2014 22:10:41 +0100 Subject: [PATCH] fix segmentation fault in test. --- src/kernel/faction.test.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/kernel/faction.test.c b/src/kernel/faction.test.c index 31747bd6c..b59a46f63 100644 --- a/src/kernel/faction.test.c +++ b/src/kernel/faction.test.c @@ -47,6 +47,7 @@ static void test_remove_empty_factions(CuTest *tc) { static void test_remove_dead_factions(CuTest *tc) { faction *f, *fm; region *r; + int fno; test_cleanup(); r = test_create_region(0, 0, 0); @@ -60,8 +61,9 @@ static void test_remove_dead_factions(CuTest *tc) { CuAssertPtrNotNull(tc, get_monsters()); fm->alive = 0; f->alive = 0; + fno = f->no; remove_empty_factions(); - CuAssertPtrEquals(tc, 0, findfaction(f->no)); + CuAssertPtrEquals(tc, 0, findfaction(fno)); CuAssertPtrEquals(tc, fm, get_monsters()); test_cleanup(); }