diff --git a/app/feature/feature-chip-id/src/main/kotlin/com/hedvig/android/feature/chip/id/navigation/ChipIdGraph.kt b/app/feature/feature-chip-id/src/main/kotlin/com/hedvig/android/feature/chip/id/navigation/ChipIdGraph.kt index d1b22df1dd..385810a8cc 100644 --- a/app/feature/feature-chip-id/src/main/kotlin/com/hedvig/android/feature/chip/id/navigation/ChipIdGraph.kt +++ b/app/feature/feature-chip-id/src/main/kotlin/com/hedvig/android/feature/chip/id/navigation/ChipIdGraph.kt @@ -11,7 +11,7 @@ import com.hedvig.android.feature.chip.id.ui.selectinsurance.SelectInsuranceForC import com.hedvig.android.navigation.compose.navDeepLinks import com.hedvig.android.navigation.compose.navdestination import com.hedvig.android.navigation.compose.navgraph -import com.hedvig.android.navigation.compose.typed.getRouteFromBackStack +import com.hedvig.android.navigation.compose.typed.getRouteFromBackStackOrNull import com.hedvig.android.navigation.compose.typedPopUpTo import com.hedvig.android.navigation.core.HedvigDeepLinkContainer import org.koin.compose.viewmodel.koinViewModel @@ -49,8 +49,8 @@ fun NavGraphBuilder.chipIdGraph( ) { navdestination { backStackEntry -> val chipIdGraphDestination = navController - .getRouteFromBackStack(backStackEntry) - val preselectedContractId = chipIdGraphDestination.contractId + .getRouteFromBackStackOrNull(backStackEntry) + val preselectedContractId = chipIdGraphDestination?.contractId val viewModel: SelectInsuranceForChipIdViewModel = koinViewModel { parametersOf(preselectedContractId) diff --git a/app/feature/feature-terminate-insurance/src/main/kotlin/com/hedvig/android/feature/terminateinsurance/navigation/TerminateInsuranceGraph.kt b/app/feature/feature-terminate-insurance/src/main/kotlin/com/hedvig/android/feature/terminateinsurance/navigation/TerminateInsuranceGraph.kt index 03f8ea7a7d..b638da707c 100644 --- a/app/feature/feature-terminate-insurance/src/main/kotlin/com/hedvig/android/feature/terminateinsurance/navigation/TerminateInsuranceGraph.kt +++ b/app/feature/feature-terminate-insurance/src/main/kotlin/com/hedvig/android/feature/terminateinsurance/navigation/TerminateInsuranceGraph.kt @@ -29,6 +29,7 @@ import com.hedvig.android.navigation.compose.navDeepLinks import com.hedvig.android.navigation.compose.navdestination import com.hedvig.android.navigation.compose.navgraph import com.hedvig.android.navigation.compose.typed.getRouteFromBackStack +import com.hedvig.android.navigation.compose.typed.getRouteFromBackStackOrNull import com.hedvig.android.navigation.compose.typedPopUpTo import com.hedvig.android.navigation.core.HedvigDeepLinkContainer import org.koin.compose.viewmodel.koinViewModel @@ -89,9 +90,9 @@ fun NavGraphBuilder.terminateInsuranceGraph( ) { navdestination { backStackEntry -> val terminateInsuranceGraphDestination = navController - .getRouteFromBackStack(backStackEntry) + .getRouteFromBackStackOrNull(backStackEntry) val viewModel: ChooseInsuranceToTerminateViewModel = koinViewModel { - parametersOf(terminateInsuranceGraphDestination.insuranceId) + parametersOf(terminateInsuranceGraphDestination?.insuranceId) } ChooseInsuranceToTerminateDestination( viewModel = viewModel,