diff --git a/jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockProcessor.java b/jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockProcessor.java index add61695e52..f00b32e2cdb 100644 --- a/jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockProcessor.java +++ b/jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockProcessor.java @@ -654,13 +654,14 @@ private static void removeUnreachableBlocks(MethodNode mth) { return; } - toRemove.forEach(BlockSplitter::detachBlock); - mth.getBasicBlocks().removeAll(toRemove); long notEmptyBlocks = toRemove.stream().filter(block -> !block.getInstructions().isEmpty()).count(); if (notEmptyBlocks != 0) { int insnsCount = toRemove.stream().mapToInt(block -> block.getInstructions().size()).sum(); mth.addWarnComment("Unreachable blocks removed: " + notEmptyBlocks + ", instructions: " + insnsCount); } + + toRemove.forEach(BlockSplitter::detachBlock); + mth.getBasicBlocks().removeAll(toRemove); } private static void clearBlocksState(MethodNode mth) { diff --git a/jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockSplitter.java b/jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockSplitter.java index d1fc23f4aac..6c89a8131ae 100644 --- a/jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockSplitter.java +++ b/jadx-core/src/main/java/jadx/core/dex/visitors/blocks/BlockSplitter.java @@ -455,7 +455,6 @@ static void detachBlock(BlockNode block) { successor.getPredecessors().remove(block); } block.add(AFlag.REMOVE); - block.getInstructions().clear(); block.getPredecessors().clear(); block.getSuccessors().clear(); } diff --git a/jadx-core/src/test/smali/conditions/TestTernary4.smali b/jadx-core/src/test/smali/conditions/TestTernary4.smali index f0f339ccb4f..3c7fdadbe38 100644 --- a/jadx-core/src/test/smali/conditions/TestTernary4.smali +++ b/jadx-core/src/test/smali/conditions/TestTernary4.smali @@ -133,8 +133,6 @@ .catchall {:try_start_14 .. :try_end_50} :catchall_4e throw p1 - - return-void .end method .method private getValueObject(Ljava/lang/String;)Ljava/lang/Object;