diff --git a/src/PlayerTools.cpp b/src/PlayerTools.cpp index 8f2e5316..6a94d84e 100644 --- a/src/PlayerTools.cpp +++ b/src/PlayerTools.cpp @@ -52,7 +52,8 @@ bool shouldTarget(CachedEntity *entity) // Don't shoot players in truce if (isTruce()) return false; - return shouldTargetSteamId(entity->player_info->friendsID); + if (entity->player_info) + return shouldTargetSteamId(entity->player_info->friendsID); } else if (entity->m_Type() == ENTITY_BUILDING) // Don't shoot buildings in truce @@ -75,7 +76,8 @@ bool shouldAlwaysRenderEsp(CachedEntity *entity) { if (entity->m_Type() == ENTITY_PLAYER) { - return shouldAlwaysRenderEspSteamId(entity->player_info->friendsID); + if (entity->player_info) + return shouldAlwaysRenderEspSteamId(entity->player_info->friendsID); } return false; @@ -150,7 +152,8 @@ static CatCommand mark_betrayal("pl_mark_betrayal", "Mark a steamid32 as betraya void onKilledBy(CachedEntity *entity) { - onKilledBy(entity->player_info->friendsID); + if (entity->player_info) + onKilledBy(entity->player_info->friendsID); } class PlayerToolsEventListener : public IGameEventListener2 diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index d15d9cfa..7831ad0c 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -364,8 +364,9 @@ static void cm() if (!isValidTarget(entity)) continue; // No enemy check, since steamid is very specific - if (steamid != entity->player_info->friendsID) // steamid check - continue; + if (entity->player_info) + if (steamid != entity->player_info->friendsID) // steamid check + continue; if (startFollow(entity, isNavBotCM)) { navinactivity.update(); @@ -399,8 +400,9 @@ static void cm() continue; if (entity->m_bEnemy()) continue; - if (accountid != entity->player_info->friendsID) - continue; + if (entity->player_info) + if (accountid != entity->player_info->friendsID) + continue; if (startFollow(entity, isNavBotCM)) { navinactivity.update(); diff --git a/src/playerlist.cpp b/src/playerlist.cpp index 645dc52c..da09b2c7 100644 --- a/src/playerlist.cpp +++ b/src/playerlist.cpp @@ -160,7 +160,7 @@ bool IsDefault(unsigned steamid) 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 true; } @@ -173,7 +173,7 @@ bool IsFriend(unsigned steamid) 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 false; } @@ -238,7 +238,7 @@ bool ChangeState(unsigned int steamid, 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 false; }