Commit 412a185f authored by Skylot's avatar Skylot

core: fix null pointer error in try/catch processing

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