summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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 11ebc4d6..eb3d6f78 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 {