Commit 412a185f authored by Skylot's avatar Skylot

core: fix null pointer error in try/catch processing

parent 20bfe838
...@@ -72,10 +72,13 @@ public class ProcessTryCatchRegions extends AbstractRegionVisitor { ...@@ -72,10 +72,13 @@ public class ProcessTryCatchRegions extends AbstractRegionVisitor {
} }
BitSet bs = new BitSet(mth.getBasicBlocks().size()); BitSet bs = new BitSet(mth.getBasicBlocks().size());
for (ExceptionHandler excHandler : tb.getHandlers()) { for (ExceptionHandler excHandler : tb.getHandlers()) {
SplitterBlockAttr splitter = excHandler.getHandlerBlock().get(AType.SPLITTER_BLOCK); BlockNode handlerBlock = excHandler.getHandlerBlock();
if (splitter != null) { if (handlerBlock != null) {
BlockNode block = splitter.getBlock(); SplitterBlockAttr splitter = handlerBlock.get(AType.SPLITTER_BLOCK);
bs.set(block.getId()); if (splitter != null) {
BlockNode block = splitter.getBlock();
bs.set(block.getId());
}
} }
} }
List<BlockNode> domBlocks = BlockUtils.bitSetToBlocks(mth, bs); List<BlockNode> domBlocks = BlockUtils.bitSetToBlocks(mth, bs);
...@@ -164,7 +167,9 @@ public class ProcessTryCatchRegions extends AbstractRegionVisitor { ...@@ -164,7 +167,9 @@ public class ProcessTryCatchRegions extends AbstractRegionVisitor {
private static boolean isHandlerPath(TryCatchBlock tb, IContainer cont) { private static boolean isHandlerPath(TryCatchBlock tb, IContainer cont) {
for (ExceptionHandler h : tb.getHandlers()) { for (ExceptionHandler h : tb.getHandlers()) {
if (RegionUtils.hasPathThroughBlock(h.getHandlerBlock(), cont)) { BlockNode handlerBlock = h.getHandlerBlock();
if (handlerBlock != null
&& RegionUtils.hasPathThroughBlock(handlerBlock, cont)) {
return true; return true;
} }
} }
......
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