diff options
author | Eric Kuck <eric@bluelinelabs.com> | 2018-07-12 19:10:35 -0500 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-13 03:46:23 +0200 |
commit | 67ea8b2936343526ff0b3f476c515f0e11dbb272 (patch) | |
tree | 84f904d66f6111a7d8f897164eb236bc62199cae /app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java | |
parent | fbaa4d9ab1b59ba4610fe273743872f35e7e9091 (diff) |
global: Add nullity annotations
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java')
-rw-r--r-- | app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java b/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java index 5c35686f..cb1712fc 100644 --- a/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java +++ b/app/src/main/java/com/wireguard/android/fragment/TunnelDetailFragment.java @@ -7,7 +7,7 @@ package com.wireguard.android.fragment; import android.os.Bundle; -import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -24,14 +24,16 @@ import com.wireguard.config.Config; */ public class TunnelDetailFragment extends BaseFragment { - private TunnelDetailFragmentBinding binding; + @Nullable private TunnelDetailFragmentBinding binding; private void onConfigLoaded(final String name, final Config config) { - binding.setConfig(new Config.Observable(config, name)); + if (binding != null) { + binding.setConfig(new Config.Observable(config, name)); + } } @Override - public void onCreate(final Bundle savedInstanceState) { + public void onCreate(@Nullable final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setHasOptionsMenu(true); } @@ -42,8 +44,8 @@ public class TunnelDetailFragment extends BaseFragment { } @Override - public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, - final Bundle savedInstanceState) { + public View onCreateView(final LayoutInflater inflater, @Nullable final ViewGroup container, + @Nullable final Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); binding = TunnelDetailFragmentBinding.inflate(inflater, container, false); binding.executePendingBindings(); @@ -57,7 +59,7 @@ public class TunnelDetailFragment extends BaseFragment { } @Override - public void onSelectedTunnelChanged(final Tunnel oldTunnel, final Tunnel newTunnel) { + public void onSelectedTunnelChanged(@Nullable final Tunnel oldTunnel, @Nullable final Tunnel newTunnel) { if (binding == null) return; binding.setTunnel(newTunnel); @@ -68,7 +70,11 @@ public class TunnelDetailFragment extends BaseFragment { } @Override - public void onViewStateRestored(final Bundle savedInstanceState) { + public void onViewStateRestored(@Nullable final Bundle savedInstanceState) { + if (binding == null) { + return; + } + binding.setFragment(this); onSelectedTunnelChanged(null, getSelectedTunnel()); super.onViewStateRestored(savedInstanceState); |