diff --git a/scripts/tests/storage.lua b/scripts/tests/storage.lua index 065cca57c..0aa0b45f7 100644 --- a/scripts/tests/storage.lua +++ b/scripts/tests/storage.lua @@ -25,6 +25,9 @@ function test_store_unit() store = storage.create(filename, "rb") assert_not_nil(store) u = store:read_unit() + assert_not_nil(u) + assert_equal(r, u.region) + assert_equal(f, u.faction) store:close() os.remove(filename) assert_not_nil(u) diff --git a/src/kernel/save.c b/src/kernel/save.c index 505120e32..3111c09e5 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -613,8 +613,7 @@ unit *read_unit(struct gamedata *data) ++u->faction->no_units; } else { - log_error("unit %s has faction == NULL\n", unitname(u)); - assert(u->faction); + log_error("unit %s has faction == NULL\n", itoa36(u->no)); return 0; }