Skip to content
Permalink
Browse files

Prevent iterator invalidation in CUnoccupiedVehicleSync::Update

  • Loading branch information...
botder committed Oct 21, 2019
1 parent b908aa8 commit 60df5988a878f5373ed4ca3ecf5f34b81276e834
Showing with 3 additions and 4 deletions.
  1. +3 −4 Server/mods/deathmatch/logic/CUnoccupiedVehicleSync.cpp
@@ -60,11 +60,10 @@ void CUnoccupiedVehicleSync::OverrideSyncer(CVehicle* pVehicle, CPlayer* pPlayer

void CUnoccupiedVehicleSync::Update()
{
// Update all the vehicle's sync states
list<CVehicle*>::const_iterator iter = m_pVehicleManager->IterBegin();
for (; iter != m_pVehicleManager->IterEnd();)
for (auto iter = m_pVehicleManager->IterBegin(); iter != m_pVehicleManager->IterEnd(); /* manual increment */)
{
UpdateVehicle(*(iter++));
std::list<CVehicle*>::const_iterator current = iter++;
UpdateVehicle(*current);
}
}

0 comments on commit 60df598

Please sign in to comment.
You can’t perform that action at this time.