Skip to content

Commit 6b7a321

Browse files
authored
Fix bug in Call information
1 parent b69904e commit 6b7a321

File tree

1 file changed

+5
-3
lines changed
  • app/src/main/java/com/wmods/wppenhacer/xposed/features/general

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ private void callInfo() throws Exception {
188188
@Override
189189
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
190190
var wamCall = param.thisObject;
191-
var ip = XposedHelpers.getObjectField(wamCall, "callSelfIpStr").toString();
192-
var platform = XposedHelpers.getObjectField(wamCall, "callPeerPlatform").toString();
191+
var ip = (String)XposedHelpers.getObjectField(wamCall, "callPeerIpStr");
192+
var platform = (String)XposedHelpers.getObjectField(wamCall, "callPeerPlatform");
193193
CompletableFuture.runAsync(() -> {
194194
try {
195195
showCallInformation(ip, platform);
@@ -202,16 +202,18 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
202202
}
203203

204204
private void showCallInformation(String ip, String platform) throws Exception {
205+
var db = new StringBuilder();
206+
if (ip != null) {
205207
var client = new OkHttpClient();
206208
var url = "http://ip-api.com/json/" + ip;
207209
var request = new okhttp3.Request.Builder().url(url).build();
208210
var content = client.newCall(request).execute().body().string();
209211
var json = new JSONObject(content);
210212
var country = json.getString("country");
211213
var city = json.getString("city");
212-
var db = new StringBuilder();
213214
db.append("Country: ").append(country).append("\n");
214215
db.append("City: ").append(city).append("\n");
216+
}
215217
db.append("Platform: ").append(platform).append("\n");
216218
db.append("IP: ").append(ip).append("\n");
217219
Utils.showNotification("Call Information", db.toString());

0 commit comments

Comments
 (0)