TunnelListFragment: do not assume binding always exists
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
		
							parent
							
								
									847da23300
								
							
						
					
					
						commit
						655a853857
					
				| @ -224,8 +224,8 @@ class TunnelListFragment : BaseFragment() { | |||||||
|         binding ?: return |         binding ?: return | ||||||
|         lifecycleScope.launch { |         lifecycleScope.launch { | ||||||
|             val tunnels = Application.getTunnelManager().getTunnels() |             val tunnels = Application.getTunnelManager().getTunnels() | ||||||
|             if (newTunnel != null) viewForTunnel(newTunnel, tunnels).setSingleSelected(true) |             if (newTunnel != null) viewForTunnel(newTunnel, tunnels)?.setSingleSelected(true) | ||||||
|             if (oldTunnel != null) viewForTunnel(oldTunnel, tunnels).setSingleSelected(false) |             if (oldTunnel != null) viewForTunnel(oldTunnel, tunnels)?.setSingleSelected(false) | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -296,8 +296,8 @@ class TunnelListFragment : BaseFragment() { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private fun viewForTunnel(tunnel: ObservableTunnel, tunnels: List<*>): MultiselectableRelativeLayout { |     private fun viewForTunnel(tunnel: ObservableTunnel, tunnels: List<*>): MultiselectableRelativeLayout? { | ||||||
|         return binding!!.tunnelList.findViewHolderForAdapterPosition(tunnels.indexOf(tunnel))!!.itemView as MultiselectableRelativeLayout |         return binding?.tunnelList?.findViewHolderForAdapterPosition(tunnels.indexOf(tunnel))?.itemView as? MultiselectableRelativeLayout | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private inner class ActionModeListener : ActionMode.Callback { |     private inner class ActionModeListener : ActionMode.Callback { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user