diff --git a/src/hardware/hw_main.c b/src/hardware/hw_main.c
index 777fd6f1c46ef20647c998f31917f05bef45df66..a1d7797eabd9fb850273e6f67e2c2320582ec1b3 100644
--- a/src/hardware/hw_main.c
+++ b/src/hardware/hw_main.c
@@ -1621,11 +1621,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
 		{
 			for (rover = gl_backsector->ffloors; rover; rover = rover->next)
 			{
+				boolean bothsides = false;
 				// Skip if it exists on both sectors.
 				ffloor_t * r2;
 				for (r2 = gl_frontsector->ffloors; r2; r2 = r2->next)
 					if (rover->master == r2->master)
-						continue;
+					{
+						bothsides = true;
+						break;
+					}
+
+				if (bothsides) continue;
 
 				if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES))
 					continue;
@@ -1761,11 +1767,17 @@ static void HWR_ProcessSeg(void) // Sort of like GLWall::Process in GZDoom
 		{
 			for (rover = gl_frontsector->ffloors; rover; rover = rover->next)
 			{
+				boolean bothsides = false;
 				// Skip if it exists on both sectors.
 				ffloor_t * r2;
 				for (r2 = gl_backsector->ffloors; r2; r2 = r2->next)
 					if (rover->master == r2->master)
-						continue;
+					{
+						bothsides = true;
+						break;
+					}
+
+				if (bothsides) continue;
 
 				if (!(rover->flags & FF_EXISTS) || !(rover->flags & FF_RENDERSIDES))
 					continue;
diff --git a/src/r_segs.c b/src/r_segs.c
index 52c19d96e04a51454b5cee695971edb5ec19034a..92b6051807a9ca59e80312b21c336d643d9c1779 100644
--- a/src/r_segs.c
+++ b/src/r_segs.c
@@ -2142,7 +2142,7 @@ void R_StoreWallRange(INT32 start, INT32 stop)
 					for (r2 = frontsector->ffloors; r2; r2 = r2->next)
 					{
 						if (r2->master == rover->master) // Skip if same control line.
-							continue;
+							break;
 
 						if (!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES))
 							continue;
@@ -2199,6 +2199,9 @@ void R_StoreWallRange(INT32 start, INT32 stop)
 
 					for (r2 = backsector->ffloors; r2; r2 = r2->next)
 					{
+						if (r2->master == rover->master) // Skip if same control line.
+							break;
+
 						if (!(r2->flags & FF_EXISTS) || !(r2->flags & FF_RENDERSIDES))
 							continue;