From 5dc034c2eda752f0735f084b91b92b41870cb6f2 Mon Sep 17 00:00:00 2001
From: Randy Heit <rheit@zdoom.fake>
Date: Tue, 30 Apr 2013 02:46:47 +0000
Subject: [PATCH] - Fixed: A_RemoveSiblings and A_KillSiblings did not check
 that the caller had a master to deduce siblings from.

SVN r4237 (trunk)
---
 src/thingdef/thingdef_codeptr.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp
index d84e647e1..f17030162 100644
--- a/src/thingdef/thingdef_codeptr.cpp
+++ b/src/thingdef/thingdef_codeptr.cpp
@@ -3780,11 +3780,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_RemoveSiblings)
 	ACTION_PARAM_START(1);
 	ACTION_PARAM_BOOL(removeall,0);
 
-	while ((mo = it.Next()) != NULL)
+	if (self->master != NULL)
 	{
-		if (mo->master == self->master && mo != self && (mo->health <= 0 || removeall))
+		while ((mo = it.Next()) != NULL)
 		{
-			P_RemoveThing(mo);
+			if (mo->master == self->master && mo != self && (mo->health <= 0 || removeall))
+			{
+				P_RemoveThing(mo);
+			}
 		}
 	}
 }
@@ -3831,11 +3834,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_RaiseSiblings)
 	TThinkerIterator<AActor> it;
 	AActor *mo;
 
-	while ((mo = it.Next()) != NULL)
+	if (self->master != NULL)
 	{
-		if (mo->master == self->master && mo != self)
+		while ((mo = it.Next()) != NULL)
 		{
-			P_Thing_Raise(mo);
+			if (mo->master == self->master && mo != self)
+			{
+				P_Thing_Raise(mo);
+			}
 		}
 	}
 }