- Fixed: Destroying a weapon that claimed it was its own sister would crash.

SVN r3441 (trunk)
This commit is contained in:
Randy Heit 2012-03-15 23:18:13 +00:00
parent f500947814
commit 5f23b4f64a

View file

@ -146,11 +146,16 @@ bool AWeapon::Use (bool pickup)
void AWeapon::Destroy() void AWeapon::Destroy()
{ {
if (SisterWeapon != NULL) AWeapon *sister = SisterWeapon;
if (sister != NULL)
{ {
// avoid recursion // avoid recursion
SisterWeapon->SisterWeapon = NULL; sister->SisterWeapon = NULL;
SisterWeapon->Destroy(); if (sister != this)
{ // In case we are our own sister, don't crash.
sister->Destroy();
}
} }
Super::Destroy(); Super::Destroy();
} }