fixed crash caused by race when dedecting if mic is on

This commit is contained in:
Daniel Gultsch 2020-05-03 11:54:31 +02:00
parent e70b6eec98
commit 3577afea4e

View file

@ -308,7 +308,12 @@ public class WebRTCWrapper {
if (audioTrack == null) { if (audioTrack == null) {
throw new IllegalStateException("Local audio track does not exist (yet)"); 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) { void setMicrophoneEnabled(final boolean enabled) {