[Android] Prevent IllegalStateException
Nicolas Pomepuy
git at videolan.org
Tue Oct 6 10:58:47 CEST 2020
vlc-android | branch: 3.3.x | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Oct 6 07:37:02 2020 +0200| [fb60b7011730a94962927dfa67593d5834e3ccc9] | committer: Nicolas Pomepuy
Prevent IllegalStateException
(cherry picked from commit 56692afd39e8a83a6ef92b09577023c40acc1cbd)
> https://code.videolan.org/videolan/vlc-android/commit/fb60b7011730a94962927dfa67593d5834e3ccc9
---
.../src/org/videolan/vlc/providers/BrowserProvider.kt | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt b/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
index 40595b3ed..4ea8655c6 100644
--- a/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/application/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -86,7 +86,10 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
private val completionHandler : CompletionHandler = object : CompletionHandler {
override fun invoke(cause: Throwable?) {
if (mediabrowser != null) AppScope.launch(coroutineContextProvider.IO) { // use global scope because current is cancelled
- mediabrowser?.release()
+ try {
+ mediabrowser?.release()
+ } catch (e: IllegalStateException) {
+ }
mediabrowser = null
}
}
@@ -104,7 +107,10 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
is ParseSubDirectories -> parseSubDirectoriesImpl(action.list)
ClearListener -> withContext(coroutineContextProvider.IO) { mediabrowser?.changeEventListener(null) }
Release -> withContext(coroutineContextProvider.IO) {
- mediabrowser?.release()
+ try {
+ mediabrowser?.release()
+ } catch (e: Exception) {
+ }
mediabrowser = null
}
is BrowseUrl -> action.deferred.complete(browseUrlImpl(action.url))
More information about the Android
mailing list