diff --git a/app/src/main/java/eu/kanade/tachiyomi/smartsearch/SmartSearchEngine.kt b/app/src/main/java/eu/kanade/tachiyomi/smartsearch/SmartSearchEngine.kt index 8d50bc3519..2bb6c0d28f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/smartsearch/SmartSearchEngine.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/smartsearch/SmartSearchEngine.kt @@ -73,7 +73,7 @@ class SmartSearchEngine( } } - return eligibleManga.maxBy { it.dist }?.manga + return eligibleManga.maxByOrNull { it.dist }?.manga } private fun removeTextInBrackets(text: String, readForward: Boolean): String { val bracketPairs = listOf( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationPresenter.kt index 47698a80dd..a99e684a68 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/MigrationPresenter.kt @@ -109,7 +109,7 @@ class MigrationPresenter( val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking() val maxChapterRead = - prevMangaChapters.filter { it.read }.maxBy { it.chapter_number }?.chapter_number + prevMangaChapters.filter { it.read }.maxOfOrNull { it.chapter_number } if (maxChapterRead != null) { val dbChapters = db.getChapters(manga).executeAsBlocking() for (chapter in dbChapters) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt index 8c13c0e816..42fa37258d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationListController.kt @@ -204,7 +204,7 @@ class MigrationListController(bundle: Bundle? = null) : } } } - }.mapNotNull { it.await() }.maxBy { it.second }?.first + }.mapNotNull { it.await() }.maxByOrNull { it.second }?.first } else { validSources.forEachIndexed { index, source -> val searchResult = try { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationProcessHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationProcessHolder.kt index c4de205f61..e8879df520 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationProcessHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/manga/process/MigrationProcessHolder.kt @@ -159,7 +159,7 @@ class MigrationProcessHolder( val mangaChapters = db.getChapters(manga).executeAsBlocking() unreadDownloadBadge.badgeView.setChapters(mangaChapters.size) - val latestChapter = mangaChapters.maxBy { it.chapter_number }?.chapter_number ?: -1f + val latestChapter = mangaChapters.maxOfOrNull { it.chapter_number } ?: -1f if (latestChapter > 0f) { subtitle.text = root.context.getString( diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt index 3cca3dba07..b95169b357 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt @@ -286,7 +286,7 @@ fun Context.openInBrowser(url: String, forceBrowser: Boolean): Boolean { ) .build() if (forceBrowser) { - val packages = getCustomTabsPackages().maxBy { it.preferredOrder } + val packages = getCustomTabsPackages().maxByOrNull { it.preferredOrder } val processName = packages?.activityInfo?.processName ?: return false intent.intent.`package` = processName }