From dd745e9728842b789fd8dbf947683e7a1b0fd623 Mon Sep 17 00:00:00 2001 From: MarcelineVQ Date: Thu, 26 Mar 2026 23:10:35 -0700 Subject: [PATCH] fix: guard getObjectByGUID against NULL object manager Crash during world teardown when minimap hooks call into WoW's FindObjectByGUID while the object manager at 0xB41414 is already NULL. --- src/wow.zig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wow.zig b/src/wow.zig index ffdefea..aca4b9b 100644 --- a/src/wow.zig +++ b/src/wow.zig @@ -201,6 +201,7 @@ pub fn unitGUID(unit_id: [*:0]const u8) u64 { /// Resolve a GUID → object pointer via the object manager hash table. pub fn getObjectByGUID(guid: u64) u32 { if (guid == 0) return 0; + if (hook.readMem(u32, o.OBJECT_MANAGER_PTR) == 0) return 0; const lo: u32 = @truncate(guid); const hi: u32 = @truncate(guid >> 32); const result = hook.call(fn (u32, u32) callconv(hook.cc.stdcall) u32, o.FN_GET_OBJECT_BY_GUID, .{ lo, hi }); @@ -212,6 +213,7 @@ pub fn getObjectByGUID(guid: u64) u32 { /// Split-GUID variant for callers that already have lo/hi parts. pub fn getObjectByGUIDSplit(guid_lo: u32, guid_hi: u32) u32 { if (guid_lo == 0 and guid_hi == 0) return 0; + if (hook.readMem(u32, o.OBJECT_MANAGER_PTR) == 0) return 0; return hook.call(fn (u32, u32) callconv(hook.cc.stdcall) u32, o.FN_GET_OBJECT_BY_GUID, .{ guid_lo, guid_hi }); }