From 74ba931a45ef763d99638359c4ebffe22ea085b6 Mon Sep 17 00:00:00 2001 From: Jonas Heubuch Date: Sat, 6 Jul 2024 18:05:53 +0200 Subject: [PATCH] :ambulance: Fix crash when no Mastodon account is linked (#375) fixes #374 --- .../main/kotlin/de/hbch/traewelling/ui/checkIn/CheckIn.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/de/hbch/traewelling/ui/checkIn/CheckIn.kt b/app/src/main/kotlin/de/hbch/traewelling/ui/checkIn/CheckIn.kt index 86259101..6406da1f 100644 --- a/app/src/main/kotlin/de/hbch/traewelling/ui/checkIn/CheckIn.kt +++ b/app/src/main/kotlin/de/hbch/traewelling/ui/checkIn/CheckIn.kt @@ -98,7 +98,13 @@ fun CheckIn( ) } val mastodonEmojis = remember { MastodonEmojis.getInstance(context) } - val instanceEmojis by remember { derivedStateOf { mastodonEmojis.emojis[URL(loggedInUser?.mastodonUrl).host] ?: listOf() } } + val instanceEmojis by remember { derivedStateOf { + if (loggedInUser?.mastodonUrl?.isNotBlank() == true) { + mastodonEmojis.emojis[URL(loggedInUser?.mastodonUrl).host] ?: listOf() + } else { + listOf() + } + } } val bottomSearchViewModel: BottomSearchViewModel = viewModel() var enableTrwlCheckIn by rememberSaveable { mutableStateOf(secureStorage.getObject(SharedValues.SS_TRWL_AUTO_LOGIN, Boolean::class.java) ?: true) }