Boss UI bar index check for splitting worms

This commit is contained in:
Dominic committed 2021-11-11 19:26:56 -06:00
1 parent 8be0e8dacf
commit 4e698731f4
1 file changed
+1 -1
+1 -1
View File
@@ -300,7 +300,7 @@ namespace CalamityMod.UI
// What this is doing is checking if the next segment agrees with the fact that the previous segment is what it is attaching to.
// If it doesn't, that means that we have reached the end of the worm.
int failsafeCounter = 0;
while (Main.npc[(int)currentSegment.ai[0]].ai[1] == currentSegment.whoAmI)
while (Main.npc.IndexInRange((int)currentSegment.ai[0]) && Main.npc[(int)currentSegment.ai[0]].ai[1] == currentSegment.whoAmI)
{
// If a segment is not active for some reason, don't go any further.
if (!currentSegment.active)