From b9c6a35fe67ee65ece988f06f3cabda9fcb1d029 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 10 Dec 2021 17:10:14 +0100 Subject: work around potentials NullPointerException --- .../base/fragments/GatewaySelectionFragment.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java index 4e7bb6ab..f2c3b2d6 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java @@ -176,10 +176,14 @@ public class GatewaySelectionFragment extends Fragment implements Observer, Loca } PreferenceHelper.setPreferredCity(context, preferredCity); EipCommand.startVPN(context, false); - Intent intent = new Intent(getContext(), MainActivity.class); - intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); - intent.setAction(ACTION_SHOW_VPN_FRAGMENT); - startActivity(intent); + try { + Intent intent = new Intent(context, MainActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.setAction(ACTION_SHOW_VPN_FRAGMENT); + context.startActivity(intent); + } catch (NullPointerException npe) { + npe.printStackTrace(); + } }).start(); } -- cgit v1.2.3