From 78b76a186c306903aaac45626f8a609b3dde59a8 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 22 Oct 2022 16:04:12 -0400 Subject: [PATCH] Avoid NPE in browse source screen It logically should never be null, yet I see crash logs about it. --- .../eu/kanade/presentation/browse/BrowseSourceScreen.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt index 268ba482a..9760c8e36 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/BrowseSourceScreen.kt @@ -226,9 +226,9 @@ fun BrowseSourceContent( val getErrorMessage: (LoadState.Error) -> String = { state -> when { state.error is NoResultsException -> context.getString(R.string.no_results_found) - state.error.message == null -> "" - state.error.message!!.startsWith("HTTP error") -> "${state.error.message}: ${context.getString(R.string.http_error_hint)}" - else -> state.error.message!! + state.error.message.isNullOrEmpty() -> "" + state.error.message.orEmpty().startsWith("HTTP error") -> "${state.error.message}: ${context.getString(R.string.http_error_hint)}" + else -> state.error.message.orEmpty() } }