fix: finding the player of an address with no user or character gives nothing

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-11-11 08:46:12 -06:00
parent 9b7573a2e9
commit fd0b2e718b

View File

@@ -33,9 +33,9 @@ bool PlayerManager::RemovePlayer(Entity* player) {
}
Entity* PlayerManager::GetPlayer(const SystemAddress& sysAddr) {
auto* entity = UserManager::Instance()->GetUser(sysAddr)->GetLastUsedChar()->GetEntity();
return entity;
auto* const user = UserManager::Instance()->GetUser(sysAddr);
auto* const character = user ? user->GetLastUsedChar() : nullptr;
return character ? character->GetEntity() : nullptr;
}
Entity* PlayerManager::GetPlayer(const std::string& name) {