mirror of
https://github.com/revanced/Apktool.git
synced 2024-08-15 03:40:34 +02:00
Fix NPE when using a custom inline method table
This commit is contained in:
parent
8aa0f31127
commit
838b35e477
@ -34,6 +34,7 @@ import com.google.common.collect.Lists;
|
|||||||
import com.google.common.collect.Ordering;
|
import com.google.common.collect.Ordering;
|
||||||
import org.jf.baksmali.Adaptors.ClassDefinition;
|
import org.jf.baksmali.Adaptors.ClassDefinition;
|
||||||
import org.jf.dexlib2.analysis.ClassPath;
|
import org.jf.dexlib2.analysis.ClassPath;
|
||||||
|
import org.jf.dexlib2.analysis.CustomInlineMethodResolver;
|
||||||
import org.jf.dexlib2.iface.ClassDef;
|
import org.jf.dexlib2.iface.ClassDef;
|
||||||
import org.jf.dexlib2.iface.DexFile;
|
import org.jf.dexlib2.iface.DexFile;
|
||||||
import org.jf.dexlib2.util.SyntheticAccessorResolver;
|
import org.jf.dexlib2.util.SyntheticAccessorResolver;
|
||||||
@ -67,6 +68,11 @@ public class baksmali {
|
|||||||
options.classPath = ClassPath.fromClassPath(options.bootClassPathDirs,
|
options.classPath = ClassPath.fromClassPath(options.bootClassPathDirs,
|
||||||
Iterables.concat(options.bootClassPathEntries, extraClassPathEntries), dexFile,
|
Iterables.concat(options.bootClassPathEntries, extraClassPathEntries), dexFile,
|
||||||
options.apiLevel);
|
options.apiLevel);
|
||||||
|
|
||||||
|
if (options.customInlineDefinitions != null) {
|
||||||
|
options.inlineResolver = new CustomInlineMethodResolver(options.classPath,
|
||||||
|
options.customInlineDefinitions);
|
||||||
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
System.err.println("\n\nError occurred while loading boot class path files. Aborting.");
|
System.err.println("\n\nError occurred while loading boot class path files. Aborting.");
|
||||||
ex.printStackTrace(System.err);
|
ex.printStackTrace(System.err);
|
||||||
|
@ -36,6 +36,7 @@ import org.jf.dexlib2.analysis.ClassPath;
|
|||||||
import org.jf.dexlib2.analysis.InlineMethodResolver;
|
import org.jf.dexlib2.analysis.InlineMethodResolver;
|
||||||
import org.jf.dexlib2.util.SyntheticAccessorResolver;
|
import org.jf.dexlib2.util.SyntheticAccessorResolver;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -73,6 +74,7 @@ public class baksmaliOptions {
|
|||||||
public boolean deodex = false;
|
public boolean deodex = false;
|
||||||
public boolean ignoreErrors = false;
|
public boolean ignoreErrors = false;
|
||||||
public boolean checkPackagePrivateAccess = false;
|
public boolean checkPackagePrivateAccess = false;
|
||||||
|
public File customInlineDefinitions = null;
|
||||||
public InlineMethodResolver inlineResolver = null;
|
public InlineMethodResolver inlineResolver = null;
|
||||||
public int registerInfo = 0;
|
public int registerInfo = 0;
|
||||||
public ClassPath classPath = null;
|
public ClassPath classPath = null;
|
||||||
|
@ -31,7 +31,6 @@ package org.jf.baksmali;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import org.apache.commons.cli.*;
|
import org.apache.commons.cli.*;
|
||||||
import org.jf.dexlib2.DexFileFactory;
|
import org.jf.dexlib2.DexFileFactory;
|
||||||
import org.jf.dexlib2.analysis.CustomInlineMethodResolver;
|
|
||||||
import org.jf.dexlib2.analysis.InlineMethodResolver;
|
import org.jf.dexlib2.analysis.InlineMethodResolver;
|
||||||
import org.jf.dexlib2.dexbacked.DexBackedDexFile;
|
import org.jf.dexlib2.dexbacked.DexBackedDexFile;
|
||||||
import org.jf.dexlib2.dexbacked.DexBackedOdexFile;
|
import org.jf.dexlib2.dexbacked.DexBackedOdexFile;
|
||||||
@ -217,7 +216,7 @@ public class main {
|
|||||||
options.ignoreErrors = true;
|
options.ignoreErrors = true;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
options.inlineResolver = new CustomInlineMethodResolver(options.classPath, new File(commandLine.getOptionValue("T")));
|
options.customInlineDefinitions = new File(commandLine.getOptionValue("T"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert false;
|
assert false;
|
||||||
@ -270,7 +269,7 @@ public class main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.inlineResolver == null && dexFile instanceof DexBackedOdexFile) {
|
if (options.customInlineDefinitions == null && dexFile instanceof DexBackedOdexFile) {
|
||||||
options.inlineResolver =
|
options.inlineResolver =
|
||||||
InlineMethodResolver.createInlineMethodResolver(((DexBackedOdexFile)dexFile).getOdexVersion());
|
InlineMethodResolver.createInlineMethodResolver(((DexBackedOdexFile)dexFile).getOdexVersion());
|
||||||
}
|
}
|
||||||
@ -529,4 +528,4 @@ public class main {
|
|||||||
"/system/framework/apache-xml.jar");
|
"/system/framework/apache-xml.jar");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user