From 49d20f41fa343459a683c9813d1765726381e453 Mon Sep 17 00:00:00 2001 From: Aurelien Hubert Date: Wed, 6 Mar 2019 18:02:38 +0100 Subject: [PATCH] Fix crash when array is null --- .../android/model/utils/FavoriteSessionFinder.kt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/net/pokeranalytics/android/model/utils/FavoriteSessionFinder.kt b/app/src/main/java/net/pokeranalytics/android/model/utils/FavoriteSessionFinder.kt index 37ee9326..3a156a62 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/utils/FavoriteSessionFinder.kt +++ b/app/src/main/java/net/pokeranalytics/android/model/utils/FavoriteSessionFinder.kt @@ -68,7 +68,7 @@ class FavoriteSessionFinder { companion object { - private val FAVORITE_SIGNIFICANT_SESSIONS = 15L + private const val FAVORITE_SIGNIFICANT_SESSIONS = 15L /** * Copies the favorite session parameters on the [newSession] @@ -94,7 +94,6 @@ class FavoriteSessionFinder { } } } - } /** @@ -123,7 +122,7 @@ class FavoriteSessionFinder { } val sortedCounters = counters.values.sortedBy { it.counter } - return sortedCounters.first().session + return sortedCounters.firstOrNull()?.session } }