diff options
author | cyBerta <cyberta@riseup.net> | 2021-12-10 17:10:14 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2021-12-10 17:10:14 +0100 |
commit | b9c6a35fe67ee65ece988f06f3cabda9fcb1d029 (patch) | |
tree | 0a96ebee96c2fd4aa6d6c5ff2f4effbe753058ab /app/src | |
parent | 5aaa3bb1c83d486e300eb98876eab26ad4325b82 (diff) |
work around potentials NullPointerException
Diffstat (limited to 'app/src')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/base/fragments/GatewaySelectionFragment.java | 12 |
1 files changed, 8 insertions, 4 deletions
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(); } |