aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ui/src/main/java/com/wireguard
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-09-20 18:05:43 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2020-09-20 18:05:43 +0200
commit655a8538578c7e7a0979ff64ee87433f920a699f (patch)
tree611bd556ef9daaac5e0c55ca02dc895f8ad26230 /ui/src/main/java/com/wireguard
parentTunnelDetailFragment: use kotlin coroutine for timer and rework nullability (diff)
downloadwireguard-android-655a8538578c7e7a0979ff64ee87433f920a699f.tar.xz
wireguard-android-655a8538578c7e7a0979ff64ee87433f920a699f.zip
TunnelListFragment: do not assume binding always exists
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main/java/com/wireguard')
-rw-r--r--ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt8
1 files changed, 4 insertions, 4 deletions
diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt
index 11ebc4d..eb3d6f7 100644
--- a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt
+++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt
@@ -224,8 +224,8 @@ class TunnelListFragment : BaseFragment() {
binding ?: return
lifecycleScope.launch {
val tunnels = Application.getTunnelManager().getTunnels()
- if (newTunnel != null) viewForTunnel(newTunnel, tunnels).setSingleSelected(true)
- if (oldTunnel != null) viewForTunnel(oldTunnel, tunnels).setSingleSelected(false)
+ if (newTunnel != null) viewForTunnel(newTunnel, tunnels)?.setSingleSelected(true)
+ if (oldTunnel != null) viewForTunnel(oldTunnel, tunnels)?.setSingleSelected(false)
}
}
@@ -296,8 +296,8 @@ class TunnelListFragment : BaseFragment() {
}
}
- private fun viewForTunnel(tunnel: ObservableTunnel, tunnels: List<*>): MultiselectableRelativeLayout {
- return binding!!.tunnelList.findViewHolderForAdapterPosition(tunnels.indexOf(tunnel))!!.itemView as MultiselectableRelativeLayout
+ private fun viewForTunnel(tunnel: ObservableTunnel, tunnels: List<*>): MultiselectableRelativeLayout? {
+ return binding?.tunnelList?.findViewHolderForAdapterPosition(tunnels.indexOf(tunnel))?.itemView as? MultiselectableRelativeLayout
}
private inner class ActionModeListener : ActionMode.Callback {