From 3577afea4e2a786aa9617fb0b507934e149aa2f7 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 3 May 2020 11:54:31 +0200 Subject: [PATCH] fixed crash caused by race when dedecting if mic is on --- .../eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java index 78d033996..99edf2853 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java @@ -308,7 +308,12 @@ public class WebRTCWrapper { if (audioTrack == null) { throw new IllegalStateException("Local audio track does not exist (yet)"); } - return audioTrack.enabled(); + try { + return audioTrack.enabled(); + } catch (final IllegalStateException e) { + //sometimes UI might still be rendering the buttons when a background thread has already ended the call + return false; + } } void setMicrophoneEnabled(final boolean enabled) {