[Android] Fix TypeCastException

Geoffrey Métais git at videolan.org
Tue Dec 10 12:16:41 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Dec 10 12:16:19 2019 +0100| [d2874029529510d87b21bc2fc6cf463b8eb511a3] | committer: Geoffrey Métais

Fix TypeCastException

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

 vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt b/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt
index d48c18e66..6aeca0705 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/TvUtil.kt
@@ -71,9 +71,8 @@ object TvUtil {
 
         override fun areContentsTheSame(oldItem: MediaLibraryItem, newItem: MediaLibraryItem): Boolean {
             if (oldItem.itemType == MediaLibraryItem.TYPE_DUMMY) return TextUtils.equals(oldItem.description, newItem.description)
-            if (oldItem.itemType != MediaLibraryItem.TYPE_MEDIA) return true
-            val oldMedia = oldItem as AbstractMediaWrapper
-            val newMedia = newItem as AbstractMediaWrapper
+            val oldMedia = oldItem as? AbstractMediaWrapper ?: return true
+            val newMedia = newItem as? AbstractMediaWrapper ?: return true
             return oldMedia === newMedia || (oldMedia.time == newMedia.time
                     && TextUtils.equals(oldMedia.artworkMrl, newMedia.artworkMrl)
                     && oldMedia.seen == newMedia.seen)



More information about the Android mailing list