Crash Fixes

This commit is contained in:
Stephen 2023-03-21 18:50:23 -04:00
parent 038da8c96f
commit 5fe65853fc
3 changed files with 15 additions and 10 deletions

View File

@ -52,6 +52,7 @@ bool shouldTarget(CachedEntity *entity)
// Don't shoot players in truce // Don't shoot players in truce
if (isTruce()) if (isTruce())
return false; return false;
if (entity->player_info)
return shouldTargetSteamId(entity->player_info->friendsID); return shouldTargetSteamId(entity->player_info->friendsID);
} }
else if (entity->m_Type() == ENTITY_BUILDING) else if (entity->m_Type() == ENTITY_BUILDING)
@ -75,6 +76,7 @@ bool shouldAlwaysRenderEsp(CachedEntity *entity)
{ {
if (entity->m_Type() == ENTITY_PLAYER) if (entity->m_Type() == ENTITY_PLAYER)
{ {
if (entity->player_info)
return shouldAlwaysRenderEspSteamId(entity->player_info->friendsID); return shouldAlwaysRenderEspSteamId(entity->player_info->friendsID);
} }
@ -150,6 +152,7 @@ static CatCommand mark_betrayal("pl_mark_betrayal", "Mark a steamid32 as betraya
void onKilledBy(CachedEntity *entity) void onKilledBy(CachedEntity *entity)
{ {
if (entity->player_info)
onKilledBy(entity->player_info->friendsID); onKilledBy(entity->player_info->friendsID);
} }

View File

@ -364,6 +364,7 @@ static void cm()
if (!isValidTarget(entity)) if (!isValidTarget(entity))
continue; continue;
// No enemy check, since steamid is very specific // No enemy check, since steamid is very specific
if (entity->player_info)
if (steamid != entity->player_info->friendsID) // steamid check if (steamid != entity->player_info->friendsID) // steamid check
continue; continue;
if (startFollow(entity, isNavBotCM)) if (startFollow(entity, isNavBotCM))
@ -399,6 +400,7 @@ static void cm()
continue; continue;
if (entity->m_bEnemy()) if (entity->m_bEnemy())
continue; continue;
if (entity->player_info)
if (accountid != entity->player_info->friendsID) if (accountid != entity->player_info->friendsID)
continue; continue;
if (startFollow(entity, isNavBotCM)) if (startFollow(entity, isNavBotCM))

View File

@ -160,7 +160,7 @@ bool IsDefault(unsigned steamid)
bool IsDefault(CachedEntity *entity) bool IsDefault(CachedEntity *entity)
{ {
if (entity && entity->player_info->friendsID) if (entity && entity->player_info && entity->player_info->friendsID)
return IsDefault(entity->player_info->friendsID); return IsDefault(entity->player_info->friendsID);
return true; return true;
} }
@ -173,7 +173,7 @@ bool IsFriend(unsigned steamid)
bool IsFriend(CachedEntity *entity) bool IsFriend(CachedEntity *entity)
{ {
if (entity && entity->player_info->friendsID) if (entity && entity->player_info && entity->player_info->friendsID)
return IsFriend(entity->player_info->friendsID); return IsFriend(entity->player_info->friendsID);
return false; return false;
} }
@ -238,7 +238,7 @@ bool ChangeState(unsigned int steamid, k_EState state, bool force)
bool ChangeState(CachedEntity *entity, k_EState state, bool force) bool ChangeState(CachedEntity *entity, k_EState state, bool force)
{ {
if (entity && entity->player_info->friendsID) if (entity && entity->player_info && entity->player_info->friendsID)
return ChangeState(entity->player_info->friendsID, state, force); return ChangeState(entity->player_info->friendsID, state, force);
return false; return false;
} }