- validate actors before processing them in the event queue.

This commit is contained in:
Christoph Oelckers 2021-09-04 10:21:19 +02:00
parent 118b3e1d70
commit 2f5be23171
2 changed files with 8 additions and 4 deletions

View file

@ -61,11 +61,10 @@ void fxFlameLick(DBloodActor* actor, int) // 0
void Remove(DBloodActor* actor, int) // 1
{
if (!actor) return;
spritetype *pSprite = &actor->s();
evKillActor(actor, kCallbackFXFlareSpark);
if (pSprite->extra > 0)
seqKill(3, pSprite->extra);
sfxKill3DSound(pSprite, 0, -1);
if (actor->hasX())
seqKill(actor);
sfxKill3DSound(actor, 0, -1);
DeleteSprite(actor);
}

View file

@ -630,6 +630,11 @@ void evProcess(unsigned int time)
{
EVENT event = *queue.begin();
queue.erase(queue.begin());
if (event.type == SS_SPRITE)
{
// Don't call events on destroyed actors. Seems to happen occasionally.
if (!event.actor || event.actor->s().statnum == kStatFree) continue;
}
if (event.cmd == kCmdCallback)
{