catch ISE around peerconnection.dispose()

Daniel Gultsch created

Change summary

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

Detailed changes

src/main/java/eu/siacs/conversations/xmpp/jingle/WebRTCWrapper.java 🔗

@@ -230,7 +230,7 @@ public class WebRTCWrapper {
         final AppRTCAudioManager audioManager = this.appRTCAudioManager;
         final EglBase eglBase = this.eglBase;
         if (peerConnection != null) {
-            peerConnection.dispose();
+            dispose(peerConnection);
             this.peerConnection = null;
         }
         if (audioManager != null) {
@@ -251,6 +251,14 @@ public class WebRTCWrapper {
         }
     }
 
+    private static void dispose(final PeerConnection peerConnection) {
+        try {
+            peerConnection.dispose();
+        } catch (final IllegalStateException e) {
+            Log.e(Config.LOGTAG,"unable to dispose of peer connection", e);
+        }
+    }
+
     void verifyClosed() {
         if (this.peerConnection != null
                 || this.eglBase != null