Fix crash after calling OnTick on removed effect (#3501)
This commit is contained in:
parent
6176019911
commit
c8b1d8a37d
@ -57,9 +57,6 @@ void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
cEntityEffect::eType EffectType = iter->first;
|
||||
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)
|
||||
++iter;
|
||||
|
||||
@ -68,6 +65,11 @@ void cPawn::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
|
||||
{
|
||||
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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user