1
0

Fix crash after calling OnTick on removed effect (#3501)

This commit is contained in:
Fabian Stein 2016-12-30 00:06:30 +01:00 committed by Mattes D
parent 6176019911
commit c8b1d8a37d

View File

@ -57,9 +57,6 @@ void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
cEntityEffect::eType EffectType = iter->first; cEntityEffect::eType EffectType = iter->first;
cEntityEffect * Effect = iter->second; cEntityEffect * Effect = iter->second;
// Call OnTick later to make sure the iterator won't be invalid
EffectsToTick.push_back(Effect);
// Iterates (must be called before any possible erasure) // Iterates (must be called before any possible erasure)
++iter; ++iter;
@ -68,6 +65,11 @@ void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{ {
RemoveEntityEffect(EffectType); RemoveEntityEffect(EffectType);
} }
// Call OnTick later to make sure the iterator won't be invalid
else
{
EffectsToTick.push_back(Effect);
}
// TODO: Check for discrepancies between client and server effect values // TODO: Check for discrepancies between client and server effect values
} }