From bd4d939a29446f963d916f2626cc11de9eff6b3b Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 21 Sep 2021 11:55:37 +0200 Subject: [PATCH] backport requireActivity method --- .../eu/siacs/conversations/ui/ConversationFragment.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 5bc24fee3..a019f282a 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -3051,4 +3051,12 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke } activity.switchToAccount(message.getConversation().getAccount(), fingerprint); } + + private Activity requireActivity() { + final Activity activity = getActivity(); + if (activity == null) { + throw new IllegalStateException("Activity not attached"); + } + return activity; + } }