From 09e46134e6bcaeb7d891afcbe757934476d07f18 Mon Sep 17 00:00:00 2001 From: fanchao Date: Tue, 13 Aug 2024 14:29:22 +1000 Subject: [PATCH] Fix crashes destroying conversation activity --- .../securesms/conversation/v2/ConversationActivityV2.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 1e6eb2489a..f4d70b7141 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -852,9 +852,11 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe } override fun onDestroy() { - viewModel.saveDraft(binding.inputBar.text.trim()) - cancelVoiceMessage() - tearDownRecipientObserver() + if(::binding.isInitialized) { + viewModel.saveDraft(binding.inputBar.text.trim()) + cancelVoiceMessage() + tearDownRecipientObserver() + } super.onDestroy() } // endregion