mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 08:00:42 +00:00
The CGPlayer sub-struct at [unit+0xE68] (guild key, PLAYER_FLAGS, quest list, visible items) exists only on real player objects. Reads of it were gated on UNIT_FLAG_PLAYER_CONTROLLED, but the server sets that flag on pets, totems, guardians, companions, and MC'd creatures too (Turtle UnitDefines.h; Pet.cpp/SpellEffects.cpp/SpellAuras.cpp setters) -- all TYPEID_UNIT creatures with no such sub-struct. On one of them the +0xE68 pointer is garbage-but-non-null, so the null check passes and the deref AVs (ERROR #132, pfUI issue #34: UnitIsInMyGuild on a nameplate pet/totem, frequent in crowded dungeons/raids). Add Unit::Flags::IsPlayerObject (m_objectType == OBJECT_TYPE_PLAYER via [obj+0x14]) and use it as the gate at every arbitrary-unit +0xE68 reader: - UnitIsInMyGuild (ReadGuildKey) -- the reported crash - UnitIsAFK/UnitIsDND (TestPlayerFlag) -- same latent crash on a pet - IsUnitOnQuest (Quest::Log::UnitHasQuest) - GetInventoryItemID (non-local unit visible-items path) Local-player-only readers are unaffected. IsPlayerControlled stays for minion/ownership classification (Unit::Pet), which wants the broad flag.