Skip to content

Commit 939d422

Browse files
author
weishu.tws
committed
[Fix]: fix crash when use XposedInstaller below 3.1.5.
1 parent 19b536a commit 939d422

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

exposed-core/src/main/java/me/weishu/exposed/ExposedBridge.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,15 @@ private static void initForXposedInstaller(Context context, ApplicationInfo appl
303303
}
304304

305305
final Class<?> xposedApp = XposedHelpers.findClass("de.robv.android.xposed.installer.XposedApp", appClassLoader);
306-
final Object xposed_prop_files = XposedHelpers.getStaticObjectField(xposedApp, "XPOSED_PROP_FILES");
307-
final int length = Array.getLength(xposed_prop_files);
308-
String xposedPropPath = xposedProp.getPath();
309-
for (int i = 0; i < length; i++) {
310-
Array.set(xposed_prop_files, i, xposedPropPath);
306+
try {
307+
final Object xposed_prop_files = XposedHelpers.getStaticObjectField(xposedApp, "XPOSED_PROP_FILES");
308+
final int length = Array.getLength(xposed_prop_files);
309+
String xposedPropPath = xposedProp.getPath();
310+
for (int i = 0; i < length; i++) {
311+
Array.set(xposed_prop_files, i, xposedPropPath);
312+
}
313+
} catch (Throwable ignored) {
314+
// only support 3.1.5 and above.
311315
}
312316

313317
DexposedBridge.findAndHookMethod(xposedApp, "getActiveXposedVersion", new XC_MethodHook() {

0 commit comments

Comments
 (0)