diff --git a/ui/src/main/java/com/wireguard/android/fragment/AddTunnelsSheet.kt b/ui/src/main/java/com/wireguard/android/fragment/AddTunnelsSheet.kt index f823b2b5..fe3eca3f 100644 --- a/ui/src/main/java/com/wireguard/android/fragment/AddTunnelsSheet.kt +++ b/ui/src/main/java/com/wireguard/android/fragment/AddTunnelsSheet.kt @@ -23,7 +23,7 @@ import com.wireguard.android.util.resolveAttribute class AddTunnelsSheet : BottomSheetDialogFragment() { - private lateinit var behavior: BottomSheetBehavior + private var behavior: BottomSheetBehavior? = null private val bottomSheetCallback = object : BottomSheetBehavior.BottomSheetCallback() { override fun onSlide(bottomSheet: View, slideOffset: Float) { } @@ -51,7 +51,7 @@ class AddTunnelsSheet : BottomSheetDialogFragment() { view.viewTreeObserver.removeOnGlobalLayoutListener(this) val dialog = dialog as BottomSheetDialog? ?: return behavior = dialog.behavior - behavior.apply { + behavior?.apply { state = BottomSheetBehavior.STATE_EXPANDED peekHeight = 0 addBottomSheetCallback(bottomSheetCallback) @@ -78,7 +78,7 @@ class AddTunnelsSheet : BottomSheetDialogFragment() { override fun dismiss() { super.dismiss() - behavior.removeBottomSheetCallback(bottomSheetCallback) + behavior?.removeBottomSheetCallback(bottomSheetCallback) } private fun requireTargetFragment(): Fragment {