diff --git a/core/src/main/java/org/teavm/common/LoopGraph.java b/core/src/main/java/org/teavm/common/LoopGraph.java index 6ba7c2f9e..cf273f376 100644 --- a/core/src/main/java/org/teavm/common/LoopGraph.java +++ b/core/src/main/java/org/teavm/common/LoopGraph.java @@ -175,7 +175,7 @@ public class LoopGraph implements Graph { if (loop == testLoop) { return bestLoop; } - if (loop.walkIndex < testLoop.walkIndex) { + if (loop.parent.walkIndex < testLoop.walkIndex) { testLoop.parent = loop.parent; loop.parent = testLoop; break;