diff --git a/android/src/main/java/com/tailscale/ipn/MainActivity.kt b/android/src/main/java/com/tailscale/ipn/MainActivity.kt index 2b9fbb5..f5900bc 100644 --- a/android/src/main/java/com/tailscale/ipn/MainActivity.kt +++ b/android/src/main/java/com/tailscale/ipn/MainActivity.kt @@ -74,11 +74,10 @@ import kotlinx.coroutines.launch class MainActivity : ComponentActivity() { private lateinit var requestVpnPermission: ActivityResultLauncher - private lateinit var navController: NavHostController + private var navController: NavHostController? = null companion object { private const val TAG = "Main Activity" - private const val START_AT_ROOT = "startAtRoot" } @@ -245,7 +244,7 @@ class MainActivity : ComponentActivity() { override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) if (intent?.getBooleanExtra(START_AT_ROOT, false) == true) { - navController.popBackStack(route = "main", inclusive = false) + navController?.popBackStack(route = "main", inclusive = false) } }