catch runtime exception when trying to stop tone manager

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/xmpp/jingle/ToneManager.java | 11 
1 file changed, 10 insertions(+), 1 deletion(-)

Detailed changes

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");
         }
     }