From 6289e048b3d2fdac9095a66cccd7b1b310f1407a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 5 Jun 2023 10:05:46 +0200 Subject: [PATCH] catch runtime exception when trying to stop tone manager --- .../siacs/conversations/xmpp/jingle/ToneManager.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java b/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java index b64f963d0..2ee307082 100644 --- a/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java +++ b/src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java @@ -160,8 +160,17 @@ class ToneManager { if (currentTone != null) { currentTone.cancel(true); } - if (toneGenerator != null) { + stopTone(toneGenerator); + } + + private static void stopTone(final ToneGenerator toneGenerator) { + if (toneGenerator == null) { + return; + } + try { toneGenerator.stopTone(); + } catch (final RuntimeException e) { + Log.w(Config.LOGTAG,"tone has already stopped"); } }