Prevent possible requireContext() crash when updating link preview.

This commit is contained in:
Greyson Parrelli
2022-02-04 09:38:30 -05:00
parent 45668e4048
commit b081452bed

View File

@@ -3149,7 +3149,7 @@ public class ConversationParentFragment extends Fragment
}
private void updateLinkPreviewState() {
if (SignalStore.settings().isLinkPreviewsEnabled() && isSecureText && !sendButton.getSelectedTransport().isSms() && !attachmentManager.isAttachmentPresent()) {
if (SignalStore.settings().isLinkPreviewsEnabled() && isSecureText && !sendButton.getSelectedTransport().isSms() && !attachmentManager.isAttachmentPresent() && getContext() != null) {
linkPreviewViewModel.onEnabled();
linkPreviewViewModel.onTextChanged(requireContext(), composeText.getTextTrimmed().toString(), composeText.getSelectionStart(), composeText.getSelectionEnd());
} else {