Merge pull request #24 from BjossiAlfreds/usetargets-crash-fix

Killtarget teamchain cleanup crash fix
This commit is contained in:
Yamagi 2019-09-15 09:28:04 +02:00 committed by GitHub
commit 120e4684d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -269,7 +269,6 @@ G_UseTargets(edict_t *ent, edict_t *activator)
{ {
edict_t *t; edict_t *t;
edict_t *master; edict_t *master;
qboolean done = false;
if (!ent || !activator) if (!ent || !activator)
{ {
@ -321,23 +320,20 @@ G_UseTargets(edict_t *ent, edict_t *activator)
{ {
/* if this entity is part of a train, cleanly remove it */ /* if this entity is part of a train, cleanly remove it */
if (t->flags & FL_TEAMSLAVE) if (t->flags & FL_TEAMSLAVE)
{
if (t->teammaster)
{ {
master = t->teammaster; master = t->teammaster;
while (!done) while (master)
{ {
if (master->teamchain == t) if (master->teamchain == t)
{ {
master->teamchain = t->teamchain; master->teamchain = t->teamchain;
done = true; break;
} }
master = master->teamchain; master = master->teamchain;
} }
} }
}
G_FreeEdict(t); G_FreeEdict(t);