Skip to content

Commit bb0c8d0

Browse files
committed
Fix opaque constant folding removing instructions when a replacement is not available
1 parent 73fea4d commit bb0c8d0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

recaf-core/src/main/java/software/coley/recaf/services/deobfuscation/transform/generic/OpaqueConstantFoldingTransformer.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,11 @@ private boolean pass1StackManipulation(@Nonnull JvmTransformerContext context, @
142142
continue;
143143
ReValue top = frame.getStack(frame.getStackSize() - 1);
144144
if (top.hasKnownValue()) {
145-
instructions.set(instruction, toInsn(top));
146-
dirty = true;
145+
AbstractInsnNode replacement = toInsn(top);
146+
if (replacement != null) {
147+
instructions.set(instruction, replacement);
148+
dirty = true;
149+
}
147150
} else if (isSupportedValueProducer(instruction.getPrevious())) {
148151
instructions.set(instruction, instruction.getPrevious().clone(Collections.emptyMap()));
149152
dirty = true;

0 commit comments

Comments
 (0)