[Android] Fix TypeCastException

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


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

Fix TypeCastException

(cherry picked from commit d2874029529510d87b21bc2fc6cf463b8eb511a3)

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

 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 abb67809e..dcdf08942 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