From 0077b29d6ea8cddea9a6d77f3ee07b22384a7788 Mon Sep 17 00:00:00 2001 From: Cody Henthorne Date: Wed, 28 Oct 2020 15:48:04 -0400 Subject: [PATCH] Mitigate PSTN callback crash when service is in background. --- .../thoughtcrime/securesms/service/WebRtcCallService.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/service/WebRtcCallService.java b/app/src/main/java/org/thoughtcrime/securesms/service/WebRtcCallService.java index dbdcd80acd..5317d029f3 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/service/WebRtcCallService.java +++ b/app/src/main/java/org/thoughtcrime/securesms/service/WebRtcCallService.java @@ -479,10 +479,12 @@ public class WebRtcCallService extends Service implements CallManager.Observer, } private void hangup() { - Intent intent = new Intent(WebRtcCallService.this, WebRtcCallService.class); - intent.setAction(ACTION_LOCAL_HANGUP); + if (serviceState != null && serviceState.getCallInfoState().getActivePeer() != null) { + Intent intent = new Intent(WebRtcCallService.this, WebRtcCallService.class); + intent.setAction(ACTION_LOCAL_HANGUP); - startService(intent); + startService(intent); + } } }