Bug 2011184 - check fragment is added before finding nav controller.#56
Closed
pollym wants to merge 1 commit intomozilla-firefox:autolandfrom
Closed
Bug 2011184 - check fragment is added before finding nav controller.#56pollym wants to merge 1 commit intomozilla-firefox:autolandfrom
pollym wants to merge 1 commit intomozilla-firefox:autolandfrom
Conversation
We are seeing `IllegalStateException`s in the play store from calling `findNavController` when the fragment is not associated with a transaction (the parentFragmentManager is null) `isAdded()` is the recommended way to find out if this fragment is attached to an activity and `findNavController()` is safe to call NB this fix is based on static analysis only - plan is to keep an eye on the crash logs after it lands to confirm it works.
Contributor
|
View this pull request in Lando to land it once approved. |
segunfamisa
approved these changes
Feb 5, 2026
Contributor
segunfamisa
left a comment
There was a problem hiding this comment.
Thank you! I think the speculative fix is okay, thank you.
segunfamisa
reviewed
Feb 5, 2026
Contributor
segunfamisa
left a comment
There was a problem hiding this comment.
Do we need to do anything when the fragment is not added? Log an error with some state?
Contributor
Author
it's a good question, but i don't think so - suspect nobody would care about this error, and it would just create noise in the logs. |
lando-prod-mozilla bot
pushed a commit
that referenced
this pull request
Feb 6, 2026
We are seeing `IllegalStateException`s in the play store from calling `findNavController` when the fragment is not associated with a transaction (the parentFragmentManager is null) `isAdded()` is the recommended way to find out if this fragment is attached to an activity and `findNavController()` is safe to call NB this fix is based on static analysis only - plan is to keep an eye on the crash logs after it lands to confirm it works. [running a try here](https://treeherder.mozilla.org/jobs?repo=try&revision=f74abab716cd9b4f9af2b1742294c4712f80644c) but it seems to have included every commit since dinosaurs roamed the earth, not sure what happened there Pull request: #56
|
Pull request closed by commit c0d96cf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We are seeing
IllegalStateExceptions in the play store from callingfindNavControllerwhen the fragment is not associated with a transaction (the parentFragmentManager is null)isAdded()is the recommended way to find out if this fragment is attached to an activity andfindNavController()is safe to callNB this fix is based on static analysis only - plan is to keep an eye on the crash logs after it lands to confirm it works.
running a try here but it seems to have included every commit since dinosaurs roamed the earth, not sure what happened there