Fix a crash when func_breakable signals it for CCSBot::OnEvent

This commit is contained in:
s1lentq 2020-07-03 08:07:20 +07:00
parent 0cd233dc06
commit cbfe8a1a0c

View File

@ -266,8 +266,17 @@ void CCSBot::OnEvent(GameEventType event, CBaseEntity *pEntity, CBaseEntity *pOt
break; break;
} }
default: 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; break;
} }
}
// Process radio events from our team // Process radio events from our team
if (pPlayer && BotRelationship(pPlayer) == BOT_TEAMMATE && event > EVENT_START_RADIO_1 && event < EVENT_END_RADIO) if (pPlayer && BotRelationship(pPlayer) == BOT_TEAMMATE && event > EVENT_START_RADIO_1 && event < EVENT_END_RADIO)