[Android] ModelsHelper: Sanity check

Geoffrey Métais git at videolan.org
Thu Mar 28 14:29:22 CET 2019


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Mar 28 13:28:59 2019 +0100| [10df7f2077b60fc803a06a3d6fd1125443fb67c4] | committer: Geoffrey Métais

ModelsHelper: Sanity check

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

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

diff --git a/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt b/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
index ef4d47148..87fdfb89c 100644
--- a/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
+++ b/vlc-android/src/org/videolan/vlc/util/ModelsHelper.kt
@@ -106,7 +106,7 @@ object ModelsHelper {
         return if (item.title.isEmpty() || !Character.isLetter(item.title[0]) || ModelsHelper.isSpecialItem(item)) "#" else item.title.substring(0, 1).toUpperCase()
     }
 
-    fun getHeader(context: Context, sort: Int, item: MediaLibraryItem, aboveItem: MediaLibraryItem?) = when (sort) {
+    fun getHeader(context: Context?, sort: Int, item: MediaLibraryItem, aboveItem: MediaLibraryItem?) = if (context !== null) when (sort) {
         Medialibrary.SORT_DEFAULT,
         Medialibrary.SORT_FILENAME,
         Medialibrary.SORT_ALPHA -> {
@@ -160,7 +160,7 @@ object ModelsHelper {
             }
         }
         else -> null
-    }
+    } else null
 
     private fun getTimeCategory(timestamp: Long): Int {
         val delta = (System.currentTimeMillis() / 1000L) - timestamp



More information about the Android mailing list