From 5f23b4f64a1884e0630673dff6650874c75475c0 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Thu, 15 Mar 2012 23:18:13 +0000 Subject: [PATCH] - Fixed: Destroying a weapon that claimed it was its own sister would crash. SVN r3441 (trunk) --- src/g_shared/a_weapons.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index 6f89154bc..e6af6bcd2 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -146,11 +146,16 @@ bool AWeapon::Use (bool pickup) void AWeapon::Destroy() { - if (SisterWeapon != NULL) + AWeapon *sister = SisterWeapon; + + if (sister != NULL) { // avoid recursion - SisterWeapon->SisterWeapon = NULL; - SisterWeapon->Destroy(); + sister->SisterWeapon = NULL; + if (sister != this) + { // In case we are our own sister, don't crash. + sister->Destroy(); + } } Super::Destroy(); }