From cbfe8a1a0c6c069d8ee95ce718f644d49f43ee14 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Fri, 3 Jul 2020 08:07:20 +0700 Subject: [PATCH] Fix a crash when func_breakable signals it for CCSBot::OnEvent --- regamedll/dlls/bot/cs_bot_event.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/regamedll/dlls/bot/cs_bot_event.cpp b/regamedll/dlls/bot/cs_bot_event.cpp index a562d4f2..0c3fb6e6 100644 --- a/regamedll/dlls/bot/cs_bot_event.cpp +++ b/regamedll/dlls/bot/cs_bot_event.cpp @@ -266,8 +266,17 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOt break; } default: + { +#ifdef REGAMEDLL_FIXES + // Make sure that the entity is a player, + // because here the entity can come as CBreakable with event EVENT_BREAK_METAL + if (pPlayer && !pPlayer->IsPlayer()) + return; +#endif + break; } + } // Process radio events from our team if (pPlayer && BotRelationship(pPlayer) == BOT_TEAMMATE && event > EVENT_START_RADIO_1 && event < EVENT_END_RADIO)