Skip to content

Commit 2d93838

Browse files
committed
Fix bug in call privacy
1 parent 7fb40fa commit 2d93838

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/src/main/java/com/wmods/wppenhacer/xposed/features/privacy/CallPrivacy.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.os.Message;
44
import android.text.TextUtils;
5+
import android.widget.Toast;
56

67
import androidx.annotation.NonNull;
78

@@ -10,6 +11,7 @@
1011
import com.wmods.wppenhacer.xposed.core.devkit.Unobfuscator;
1112
import com.wmods.wppenhacer.xposed.features.general.Tasker;
1213
import com.wmods.wppenhacer.xposed.utils.ReflectionUtils;
14+
import com.wmods.wppenhacer.xposed.utils.Utils;
1315

1416
import java.lang.reflect.InvocationTargetException;
1517
import java.util.ArrayList;
@@ -34,8 +36,16 @@ public void doHook() throws Throwable {
3436
XposedBridge.hookMethod(onCallReceivedMethod, new XC_MethodHook() {
3537
@Override
3638
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
37-
Object callinfo = ((Message) param.args[0]).obj;
39+
Object callinfo = null;
3840
Class<?> callInfoClass = XposedHelpers.findClass("com.whatsapp.voipcalling.CallInfo", classLoader);
41+
if (param.args[0] instanceof Message) {
42+
callinfo = ((Message) param.args[0]).obj;
43+
} else if (param.args.length > 1 && callInfoClass.isInstance(param.args[1])) {
44+
callinfo = param.args[1];
45+
} else {
46+
Utils.showToast("Invalid call info", Toast.LENGTH_SHORT);
47+
return;
48+
}
3949
if (callinfo == null || !callInfoClass.isInstance(callinfo)) return;
4050
if ((boolean) XposedHelpers.callMethod(callinfo, "isCaller")) return;
4151
var userJid = XposedHelpers.callMethod(callinfo, "getPeerJid");

0 commit comments

Comments
 (0)