From eb52c8ca58e58f9f7bc595ed128e2b20c4fba103 Mon Sep 17 00:00:00 2001 From: Lakoja Date: Wed, 5 Apr 2023 10:54:03 +0200 Subject: [PATCH] Do not crash on empty relationship response --- .../keylesspalace/tusky/components/account/AccountViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/account/AccountViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/account/AccountViewModel.kt index af665e7c..5b32e340 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/account/AccountViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/account/AccountViewModel.kt @@ -85,7 +85,7 @@ class AccountViewModel @Inject constructor( mastodonApi.relationships(listOf(accountId)) .fold( { relationships -> - relationshipData.postValue(Success(relationships[0])) + relationshipData.postValue(if (relationships.isNotEmpty()) Success(relationships[0]) else Error()) }, { t -> Log.w(TAG, "failed obtaining relationships", t)