Commit 5258c836 authored by Skylot's avatar Skylot

core: fix NPE in loops processing

parent eb6d145d
...@@ -311,11 +311,14 @@ public class RegionMaker { ...@@ -311,11 +311,14 @@ public class RegionMaker {
AttributesList outAttrs = out.getAttributes(); AttributesList outAttrs = out.getAttributes();
if (outAttrs.contains(AttributeFlag.LOOP_START) if (outAttrs.contains(AttributeFlag.LOOP_START)
&& outAttrs.get(AttributeType.LOOP) != loop && outAttrs.get(AttributeType.LOOP) != loop
&& stack.peekRegion() instanceof LoopRegion && stack.peekRegion() instanceof LoopRegion) {
&& RegionUtils.isRegionContainsBlock(stack.peekRegion(), out)) { LoopRegion outerLoop = (LoopRegion) stack.peekRegion();
if (outerLoop.getBody() == null /* processing not yet finished */
|| RegionUtils.isRegionContainsBlock(outerLoop, out)) {
// exit to outer loop which already processed // exit to outer loop which already processed
out = null; out = null;
} }
}
stack.push(loopRegion); stack.push(loopRegion);
stack.addExit(out); stack.addExit(out);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment