Skip to content

Conversation

@easternkite
Copy link

Summary

This PR fixes a crash that occurs when the back button is pressed rapidly while on certain screens (e.g. Create, About).

The issue was caused by backStack.removeLastOrNull() being called without validating the current top of the back stack, leading to IllegalArgumentException: NavDisplay backstack cannot be empty.

Changes

  • Added type-checks before removing the top of the back stack to ensure the app is in a valid navigation state.
  • Specifically checks if backStack.last() is of type Create or About before removing it.

@riggaroo
Copy link
Collaborator

riggaroo commented Jun 9, 2025

thanks - this will be fixed in the next version of nav3 - so we wont need to implement this fix: https://issuetracker.google.com/419017866

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants