From 4a709b3a3d0fc763d36390d0ab079135e3c19d73 Mon Sep 17 00:00:00 2001 From: Kateryna Kostiuk Date: Tue, 12 Dec 2017 16:37:05 -0500 Subject: [PATCH] fix: present contact request conversation This patch checks if the conversation exists when presenting conversation screen for receiving contact request. Change-Id: Ic9d2b0c1ef5a00f5ce4443914877af8bde852d21 Reviewed-by: Andreas Traczyk --- .../ContactRequests/ContactRequestsViewModel.swift | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Ring/Ring/Features/ContactRequests/ContactRequestsViewModel.swift b/Ring/Ring/Features/ContactRequests/ContactRequestsViewModel.swift index 0e7c2e4..5ff4d91 100644 --- a/Ring/Ring/Features/ContactRequests/ContactRequestsViewModel.swift +++ b/Ring/Ring/Features/ContactRequests/ContactRequestsViewModel.swift @@ -160,9 +160,14 @@ class ContactRequestsViewModel: Stateable, ViewModel { func showConversation (forRingId ringId: String) { let conversationViewModel = ConversationViewModel(with: self.injectionBag) - let conversation = self.conversationService.findConversation(withRingId: ringId, - withAccountId: (accountsService.currentAccount?.id)!) - conversationViewModel.conversation = Variable(conversation!) + guard let account = accountsService.currentAccount else { + return + } + + guard let conversation = self.conversationService.findConversation(withRingId: ringId, withAccountId: account.id) else { + return + } + conversationViewModel.conversation = Variable(conversation) self.stateSubject.onNext(ConversationsState.conversationDetail(conversationViewModel: conversationViewModel)) } } -- GitLab