aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSamuel Holland <samuel@sholland.org>2018-01-16 23:12:49 -0600
committerSamuel Holland <samuel@sholland.org>2018-01-18 04:10:58 -0600
commit8dde6c3c0f0d33e3eef59e595b2a5fff816994fc (patch)
treea54d09669f4f202cfb045bd197c9305c284a6047
parentTunnelManager: Use constants directly where appropriate (diff)
downloadwireguard-android-8dde6c3c0f0d33e3eef59e595b2a5fff816994fc.tar.xz
wireguard-android-8dde6c3c0f0d33e3eef59e595b2a5fff816994fc.zip
fragments: Be extra paranoid about the binding getting destroyed
Signed-off-by: Samuel Holland <samuel@sholland.org>
-rw-r--r--app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
index f03aeb9d..352fbfbd 100644
--- a/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
+++ b/app/src/main/java/com/wireguard/android/fragment/TunnelListFragment.java
@@ -130,7 +130,8 @@ public class TunnelListFragment extends BaseFragment {
public void onRequestCreateConfig(@SuppressWarnings("unused") final View view) {
startActivity(new Intent(getActivity(), TunnelCreatorActivity.class));
- binding.createMenu.collapse();
+ if (binding != null)
+ binding.createMenu.collapse();
}
public void onRequestImportConfig(@SuppressWarnings("unused") final View view) {
@@ -138,7 +139,8 @@ public class TunnelListFragment extends BaseFragment {
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("*/*");
startActivityForResult(intent, REQUEST_IMPORT);
- binding.createMenu.collapse();
+ if (binding != null)
+ binding.createMenu.collapse();
}
@Override
@@ -261,14 +263,16 @@ public class TunnelListFragment extends BaseFragment {
final int position, final long id) {
if (actionMode != null)
return false;
- binding.tunnelList.setItemChecked(position, true);
+ if (binding != null)
+ binding.tunnelList.setItemChecked(position, true);
return true;
}
@Override
@SuppressLint("ClickableViewAccessibility")
public boolean onTouch(final View view, final MotionEvent motionEvent) {
- binding.createMenu.collapse();
+ if (binding != null)
+ binding.createMenu.collapse();
return false;
}
}