Avoid NPE in browse source screen

It logically should never be null, yet I see crash logs about it.

(cherry picked from commit 78b76a186c306903aaac45626f8a609b3dde59a8)
This commit is contained in:
arkon 2022-10-22 16:04:12 -04:00 committed by Jobobby04
parent 3314b46630
commit 047227a74a

View File

@ -264,9 +264,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()
}
}