From b4767626d96d10058969e84e717f4cd433c5fae1 Mon Sep 17 00:00:00 2001 From: Skylot Date: Mon, 12 Jan 2015 23:26:03 +0300 Subject: [PATCH] core: prevent ClassCastException in StringBuilder chain converter --- .../java/jadx/core/dex/visitors/SimplifyVisitor.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jadx-core/src/main/java/jadx/core/dex/visitors/SimplifyVisitor.java b/jadx-core/src/main/java/jadx/core/dex/visitors/SimplifyVisitor.java index feeb7aded..104c8a96a 100644 --- a/jadx-core/src/main/java/jadx/core/dex/visitors/SimplifyVisitor.java +++ b/jadx-core/src/main/java/jadx/core/dex/visitors/SimplifyVisitor.java @@ -174,9 +174,14 @@ public class SimplifyVisitor extends AbstractVisitor { iwa = (InsnWrapArg)argInsn.getArg(0); argInd = 3; // Cause for loop below to skip to after the constructor } else { - ConstStringNode csn = (ConstStringNode)chain.get(0); - iwa = new InsnWrapArg(csn); - argInd = 2; // Cause for loop below to skip to after the constructor + InsnNode firstNode = chain.get(0); + if (firstNode instanceof ConstStringNode) { + ConstStringNode csn = (ConstStringNode) firstNode; + iwa = new InsnWrapArg(csn); + argInd = 2; // Cause for loop below to skip to after the constructor + } else { + return null; + } } concatInsn.addArg(iwa); }