Skip to content

Commit

Permalink
fix(SaveGame): properly return NULL from load[Current]World
Browse files Browse the repository at this point in the history
  • Loading branch information
lmichaelis committed Jun 17, 2024
1 parent 4c19e22 commit b8b7958
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/SaveGame.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,17 @@ ZkBool ZkSaveGame_save(ZkSaveGame* slf, ZkString path, ZkWorld* world, ZkString
ZkWorld* ZkSaveGame_loadCurrentWorld(ZkSaveGame const* slf) {
ZKC_TRACE_FN();
ZKC_CHECK_NULL(slf);
return new ZkWorld(slf->load_world());

auto world = slf->load_world();
return world == nullptr ? nullptr : new ZkWorld(world);
}

ZkWorld* ZkSaveGame_loadWorld(ZkSaveGame const* slf, ZkString name) {
ZKC_TRACE_FN();
ZKC_CHECK_NULL(slf, name);
return new ZkWorld(slf->load_world(name));

auto world = slf->load_world(name);
return world == nullptr ? nullptr : new ZkWorld(world);
}

ZkSaveMetadata* ZkSaveGame_getMetadata(ZkSaveGame* slf) {
Expand Down

0 comments on commit b8b7958

Please sign in to comment.