diff --git a/src/player/NameCache.cpp b/src/player/NameCache.cpp index cb4e0896..9b17daac 100644 --- a/src/player/NameCache.cpp +++ b/src/player/NameCache.cpp @@ -494,6 +494,17 @@ int __fastcall ScanCallback(void * /*context*/, void * /*edx*/, uint64_t guid) { } void ScanVisibleObjects() { + // The iterator's prologue is `mov eax, [VAR_LOCAL_PLAYER_PTR]` + + // unconditional `mov ebx, [eax+0xAC]` — at the glue / character- + // select screen the global is NULL and the engine crashes on the + // deref. Gate the call ourselves rather than relying on other + // DLLs' hooks to catch it; we've seen VanillaMinimapTracking's + // guard not fire when ClassicAPI and VMT are both loaded and our + // path through `FrameRegisterEvent_h → Tick → MaybeScan` reaches + // the iterator during glue Lua script load. + if (*reinterpret_cast( + static_cast(Offsets::VAR_LOCAL_PLAYER_PTR)) == nullptr) + return; auto enumerate = reinterpret_cast( static_cast(Offsets::FUN_CLNT_OBJ_MGR_ENUM_VISIBLE_OBJECTS)); enumerate(reinterpret_cast(&ScanCallback), nullptr);