From f5ac2b26a9efea7ff2efbf64a1ec1dd3be9e35cf Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 26 Feb 2021 21:46:43 +0100 Subject: catch rare IllegalStateException in EipFragment --- .../leap/bitmaskclient/base/fragments/EipFragment.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'app/src') diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java index b99182ae..615221ae 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java @@ -176,12 +176,18 @@ public class EipFragment extends Fragment implements Observer { View view = inflater.inflate(R.layout.f_eip, container, false); unbinder = ButterKnife.bind(this, view); - Bundle arguments = getArguments(); - if (arguments != null && arguments.containsKey(ASK_TO_CANCEL_VPN) && arguments.getBoolean(ASK_TO_CANCEL_VPN)) { - arguments.remove(ASK_TO_CANCEL_VPN); - setArguments(arguments); - askToStopEIP(); + try { + Bundle arguments = getArguments(); + if (arguments != null && arguments.containsKey(ASK_TO_CANCEL_VPN) && arguments.getBoolean(ASK_TO_CANCEL_VPN)) { + arguments.remove(ASK_TO_CANCEL_VPN); + setArguments(arguments); + askToStopEIP(); + } + } catch (IllegalStateException e) { + // probably setArguments failed because the fragments state is already saved + e.printStackTrace(); } + restoreFromSavedInstance(savedInstanceState); return view; } -- cgit v1.2.3