From 746e1ca936de04434a8989e41a645fdf6738edc3 Mon Sep 17 00:00:00 2001 From: TerrificTrifid <99054745+TerrificTrifid@users.noreply.github.com> Date: Wed, 4 Jan 2023 11:03:45 -0600 Subject: [PATCH] Stop recursion scanning if it runs too long --- NewHorizons/Builder/Body/BrambleDimensionBuilder.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs index 13c903c3..02f32731 100644 --- a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs +++ b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs @@ -256,6 +256,7 @@ namespace NewHorizons.Builder.Body foreach (var senderWarp in outerFogWarpVolume._senderWarps.ToList()) { var currentWarp = senderWarp; + var n = 0; while (currentWarp.GetContainerWarpVolume() != null) { if (currentWarp.GetContainerWarpVolume() == outerFogWarpVolume && currentWarp != senderWarp) // game already fixes here to here recursion @@ -264,6 +265,8 @@ namespace NewHorizons.Builder.Body break; } currentWarp = (InnerFogWarpVolume)currentWarp.GetContainerWarpVolume().GetLinkedFogWarpVolume(); + n++; + if (n > 100) break; // just in case it gets caught in something else's recursion or there's no outside exit } } });