From 3a75ca25a3a163360beccb87f282d0219a4536c5 Mon Sep 17 00:00:00 2001 From: Konrad Pozniak Date: Fri, 14 Feb 2020 19:03:42 +0100 Subject: [PATCH] [Tusky10] fix crash when bookmarking a conversation while offline (#1686) --- .../tusky/components/conversation/ConversationsViewModel.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsViewModel.kt b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsViewModel.kt index 0205ddec..c6fa84b4 100644 --- a/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsViewModel.kt +++ b/app/src/main/java/com/keylesspalace/tusky/components/conversation/ConversationsViewModel.kt @@ -74,6 +74,7 @@ class ConversationsViewModel @Inject constructor( } .subscribeOn(Schedulers.io()) .doOnError { t -> Log.w("ConversationViewModel", "Failed to bookmark conversation", t) } + .onErrorReturnItem(0) .subscribe() .autoDispose() } @@ -127,7 +128,7 @@ class ConversationsViewModel @Inject constructor( } fun remove(position: Int) { - conversations.value?.getOrNull(position)?.let { conversation -> + conversations.value?.getOrNull(position)?.let { refresh() } }