[Android] Fix TypeCastException

Nicolas Pomepuy git at videolan.org
Thu Sep 12 16:34:27 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Wed Sep 11 09:29:37 2019 +0200| [78efb6e13a10399d0739eaafa5d6d40c3e287102] | committer: Geoffrey Métais

Fix TypeCastException

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

 .../src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt b/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
index 055208a74..77a71deb9 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/FileBrowserTvFragment.kt
@@ -182,7 +182,7 @@ class FileBrowserTvFragment : BaseBrowserTvFragment(), PathAdapterListener {
             animationDelegate.setVisibility(binding.favoriteButton, View.VISIBLE)
             animationDelegate.setVisibility(binding.imageButtonFavorite, View.VISIBLE)
             animationDelegate.setVisibility(binding.favoriteDescription, View.VISIBLE)
-            favExists = withContext(Dispatchers.IO) { browserFavRepository.browserFavExists((item as MediaWrapper).uri) }
+            favExists = withContext(Dispatchers.IO) { if (item == null) false else if (item is MediaWrapper) browserFavRepository.browserFavExists((item as MediaWrapper).uri) else false }
             binding.favoriteButton.setImageResource(if (favExists) R.drawable.ic_menu_fav_tv else R.drawable.ic_menu_not_fav_tv)
             binding.imageButtonFavorite.setImageResource(if (favExists) R.drawable.ic_menu_fav_tv_normal else R.drawable.ic_menu_not_fav_tv_normal)
         }



More information about the Android mailing list