[Android] ModelsHelper: Sanity check

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


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

ModelsHelper: Sanity check

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

 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