[Android] Browser: prevent ClosedSendChannelException

Geoffrey Métais git at videolan.org
Mon Dec 17 11:11:14 CET 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Dec 17 10:35:18 2018 +0100| [a7e4fb5fe5e9088a2939ba7237a8ef4dd02a6530] | committer: Geoffrey Métais

Browser: prevent ClosedSendChannelException

> https://code.videolan.org/videolan/vlc-android/commit/a7e4fb5fe5e9088a2939ba7237a8ef4dd02a6530
---

 vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
index ab572d281..7dc4e7605 100644
--- a/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
+++ b/vlc-android/src/org/videolan/vlc/providers/BrowserProvider.kt
@@ -178,12 +178,12 @@ abstract class BrowserProvider(val context: Context, val dataset: LiveDataset<Me
     }
 
     override fun onMediaAdded(index: Int, media: Media) {
-        if (!browserChannel.isClosedForReceive) {
+        if (!browserChannel.isClosedForSend) {
             media.retain()
             browserChannel.offer(media)
         }
     }
-    override fun onBrowseEnd() { browserChannel.close() }
+    override fun onBrowseEnd() { if (!browserChannel.isClosedForSend) browserChannel.close() }
     override fun onMediaRemoved(index: Int, media: Media){}
 
     private val sb = StringBuilder()



More information about the Android mailing list