Skip to content

Commit

Permalink
Fixed possible crash
Browse files Browse the repository at this point in the history
  • Loading branch information
XutaxKamay committed Sep 14, 2024
1 parent 3291b70 commit db03935
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions game/server/cstrike/bot/cs_bot_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1942,7 +1942,16 @@ class CheckAreasOverlappingBreakable
//--------------------------------------------------------------------------------------------------------------
void CCSBotManager::OnBreakBreakable( IGameEvent *event )
{
CheckAreasOverlappingBreakable collector( UTIL_EntityByIndex( event->GetInt( "entindex" ) ) );
auto ent = UTIL_EntityByIndex( event->GetInt( "entindex" ) );

if ( !ent )
{
// TODO_ENHANCED.
DevMsg("CCSBotManager::OnBreakBreakable bug\n");
return;
}

CheckAreasOverlappingBreakable collector( ent );
TheNavMesh->ForAllAreas( collector );

CCSBOTMANAGER_ITERATE_BOTS( OnBreakBreakable, event );
Expand All @@ -1952,7 +1961,16 @@ void CCSBotManager::OnBreakBreakable( IGameEvent *event )
//--------------------------------------------------------------------------------------------------------------
void CCSBotManager::OnBreakProp( IGameEvent *event )
{
CheckAreasOverlappingBreakable collector( UTIL_EntityByIndex( event->GetInt( "entindex" ) ) );
auto ent = UTIL_EntityByIndex( event->GetInt( "entindex" ) );

if ( !ent )
{
// TODO_ENHANCED.
DevMsg("CCSBotManager::OnBreakProp bug\n");
return;
}

CheckAreasOverlappingBreakable collector( ent );
TheNavMesh->ForAllAreas( collector );

CCSBOTMANAGER_ITERATE_BOTS( OnBreakProp, event );
Expand Down

0 comments on commit db03935

Please sign in to comment.