Skip to content

Commit 2a19bf4

Browse files
committed
If the step index saved in the instance state is invalid reset the wizard
1 parent 93e4b7e commit 2a19bf4

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

WordPress/src/main/java/org/wordpress/android/ui/sitecreation/SiteCreationMainVM.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,12 @@ class SiteCreationMainVM @Inject constructor(
169169
} else {
170170
siteCreationState = requireNotNull(savedInstanceState.getParcelableCompat(KEY_SITE_CREATION_STATE))
171171
val currentStepIndex = savedInstanceState.getInt(KEY_CURRENT_STEP)
172-
wizardManager.setCurrentStepIndex(currentStepIndex)
172+
try {
173+
wizardManager.setCurrentStepIndex(currentStepIndex)
174+
} catch (e: IllegalStateException) {
175+
// If the current step index is invalid, we reset the wizard
176+
wizardManager.setCurrentStepIndex(0)
177+
}
173178
}
174179
isStarted = true
175180
}

0 commit comments

Comments
 (0)