From 5dfde14bd15667bd5b9d5dae7e1eda3e0a8be3f2 Mon Sep 17 00:00:00 2001 From: Luis Michaelis Date: Sat, 24 Feb 2024 12:43:53 +0100 Subject: [PATCH] fix(SaveGame): check for `nullptr` in `LoadWorld` --- ZenKit/SaveGame.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ZenKit/SaveGame.cs b/ZenKit/SaveGame.cs index 18bdc07..76a8b39 100644 --- a/ZenKit/SaveGame.cs +++ b/ZenKit/SaveGame.cs @@ -449,16 +449,16 @@ public bool Save(string path, World world, string worldName) return Native.ZkSaveGame_save(_handle, path, world.Handle, worldName); } - public World LoadWorld() + public World? LoadWorld() { var handle = Native.ZkSaveGame_loadCurrentWorld(_handle); - return new World(handle); + return handle == UIntPtr.Zero ? null : new World(handle); } - public World LoadWorld(string name) + public World? LoadWorld(string name) { var handle = Native.ZkSaveGame_loadWorld(_handle, name); - return new World(handle); + return handle == UIntPtr.Zero ? null : new World(handle); } } } \ No newline at end of file