Fix crash for mismatched account case #12914
Merged
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.
(cherry picked from commit 8219ffa)
Description
This fixes a crash on the site picker screen when the sites data is null. I couldn't reproduce the crash. But when the sites.value is null for any reason, it makes sense to hide the primary button on the site picker screen.
This case may occur rarely and temporarily when the screen is initializing.
Steps to reproduce
"To reproduce the issue, you need a WordPress.com account with 0 sites. Not even a blog. Which is tricky to get through the normal flow because WP.com will create 1 blog for you as soon as you create a new account. However, if you delete that blog (and wait a few hours until the deletion is completed) you'll end up with a WP.com account with 0 sites. Using that account o log into any Jetpack connected site will result in the account mismatch screen and the app crashing. - #12889 (comment)"
Testing information
Tested normal mismatch account case.
The tests that have been performed
Tested normal mismatch account case again for this PR.

RELEASE-NOTES.txtif necessary. Use the "[Internal]" label for non-user-facing changes.Reviewer (or Author, in the case of optional code reviews):
Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement: