[Android] ExternalMonitor: catch IllegalArgumentException
Geoffrey Métais
git at videolan.org
Tue Oct 1 14:33:48 CEST 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Sep 30 10:37:56 2019 +0200| [993287262e00c4fe633ada29cfe5188adec57658] | committer: Geoffrey Métais
ExternalMonitor: catch IllegalArgumentException
Sometimes, broadcast listener registering is saved but not valid
> https://code.videolan.org/videolan/vlc-android/commit/993287262e00c4fe633ada29cfe5188adec57658
---
vlc-android/src/org/videolan/vlc/ExternalMonitor.kt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/ExternalMonitor.kt b/vlc-android/src/org/videolan/vlc/ExternalMonitor.kt
index 2019e2004..74adde90f 100644
--- a/vlc-android/src/org/videolan/vlc/ExternalMonitor.kt
+++ b/vlc-android/src/org/videolan/vlc/ExternalMonitor.kt
@@ -190,7 +190,9 @@ object ExternalMonitor : BroadcastReceiver(), LifecycleObserver, CoroutineScope
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
internal fun unregister() {
val ctx = VLCApplication.appContext
- if (registered) ctx.unregisterReceiver(this)
+ if (registered) try {
+ ctx.unregisterReceiver(this)
+ } catch (iae: IllegalArgumentException) {}
registered = false
connected.value = false
devices.clear()
More information about the Android
mailing list