From 5bf71bdb18ec41aab1f48ab927151db9b6967207 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Tue, 8 Apr 2025 06:31:12 +0700 Subject: [PATCH] CCSBot::FindMostDangerousThreat: Fix crash when m_pActiveItem is null Related #1055 --- regamedll/dlls/bot/cs_bot_vision.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/regamedll/dlls/bot/cs_bot_vision.cpp b/regamedll/dlls/bot/cs_bot_vision.cpp index 56f75678..5e4e3026 100644 --- a/regamedll/dlls/bot/cs_bot_vision.cpp +++ b/regamedll/dlls/bot/cs_bot_vision.cpp @@ -797,7 +797,9 @@ CBasePlayer *CCSBot::FindMostDangerousThreat() float distSq = d.LengthSquared(); #ifdef REGAMEDLL_ADD - if (isSniperRifle(pPlayer->m_pActiveItem)) { + CBasePlayerWeapon *pCurrentWeapon = static_cast(pPlayer->m_pActiveItem); + if (pCurrentWeapon && isSniperRifle(pCurrentWeapon)) + { m_isEnemySniperVisible = true; if (sniperThreat) {