Skip to content

Commit f939487

Browse files
committed
Fix bug in initialCapacity of ArrayList
Signed-off-by: Dev4Mod <[email protected]>
1 parent 9d07cad commit f939487

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/features/general/PinnedLimit.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.wmods.wppenhacer.xposed.core.Feature;
99
import com.wmods.wppenhacer.xposed.core.devkit.Unobfuscator;
1010

11+
import java.util.ArrayList;
1112
import java.util.Collection;
1213
import java.util.Iterator;
1314
import java.util.LinkedHashMap;
@@ -50,6 +51,17 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
5051
}
5152
});
5253

54+
// Fix bug in initialCapacity of ArrayList
55+
XposedHelpers.findAndHookConstructor(ArrayList.class, int.class, new XC_MethodHook() {
56+
@Override
57+
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
58+
if ((int) param.args[0] < 0) {
59+
param.args[0] = Math.abs((int) param.args[0]);
60+
}
61+
}
62+
});
63+
64+
5365
// This creates a modified linkedhashMap to return 0 if the fixed list is less than 60.
5466
XposedBridge.hookMethod(pinnedSetMethod, new XC_MethodHook() {
5567

0 commit comments

Comments
 (0)