This repository was archived by the owner on Aug 22, 2022. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -1195,11 +1195,11 @@ void CGameHandler::handleClientDisconnection(std::shared_ptr<CConnection> c)
11951195{
11961196	for (auto  playerConns : connections)
11971197	{
1198- 		for (auto  conn :  playerConns.second )
1198+ 		for (auto  i =  playerConns.second . begin (); i != playerConns. second . end ();  )
11991199		{
1200- 			if (lobby->state  != EServerState::SHUTDOWN && conn  == c)
1200+ 			if (lobby->state  != EServerState::SHUTDOWN && *i  == c)
12011201			{
1202- 				vstd::erase_if_present ( playerConns.second , conn );
1202+ 				i =  playerConns.second . erase (i );
12031203				if (playerConns.second .size ())
12041204					continue ;
12051205				PlayerCheated pc;
@@ -1208,6 +1208,8 @@ void CGameHandler::handleClientDisconnection(std::shared_ptr<CConnection> c)
12081208				sendAndApply (&pc);
12091209				checkVictoryLossConditionsForPlayer (playerConns.first );
12101210			}
1211+ 			else 
1212+ 				++i;
12111213		}
12121214	}
12131215}
@@ -5267,7 +5269,7 @@ void CGameHandler::checkVictoryLossConditionsForAll()
52675269void  CGameHandler::checkVictoryLossConditionsForPlayer (PlayerColor player)
52685270{
52695271	const  PlayerState * p = getPlayer (player);
5270- 	if  (p->status  != EPlayerStatus::INGAME) return ;
5272+ 	if  (!p ||  p->status  != EPlayerStatus::INGAME) return ;
52715273
52725274	auto  victoryLossCheckResult = gs->checkForVictoryAndLoss (player);
52735275
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments