From 973db70b537a9ad25f9f3fcc59a12466ec3cae16 Mon Sep 17 00:00:00 2001 From: Moez Bhatti Date: Mon, 13 Aug 2018 07:10:25 +0200 Subject: [PATCH] Fix crash when trying to call conversation with empty recipient list --- .../java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt index f391d8ed7..51dea9846 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt @@ -298,7 +298,7 @@ class ComposeViewModel @Inject constructor( view.optionsItemIntent .filter { it == R.id.call } .withLatestFrom(conversation) { _, conversation -> conversation } - .mapNotNull { conversation -> conversation.recipients[0] } + .mapNotNull { conversation -> conversation.recipients.firstOrNull() } .map { recipient -> recipient.address } .autoDisposable(view.scope()) .subscribe { address -> navigator.makePhoneCall(address) }