Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on tapping Account Settings menu for accounts with no sites #19418

Conversation

staskus
Copy link
Contributor

@staskus staskus commented Oct 7, 2022

Fixes #19413

Description

Crash on tapping Account Settings menu for accounts with no sites. It happens because defaultBlog is nil.

Regression from Blog service lookup blog

Solution

Treat defaultBlog as an optional.

To avoid such issues in the future we could set nullable/nonnull attributes in WPAccount.h.

Testing instructions

Case 1:

  1. Fresh install the app
  2. Create a new account or login with an account with no sites created or added
  3. Go to My Site
  4. Click on Me (Avatar on the right top corner of the screen)
  5. Click on Account Settings
  6. It should open without a crash

Regression Notes

  1. Potential unintended areas of impact

  2. What I did to test those areas of impact (or what existing automated tests I relied on)

  3. What automated tests I added (or what prevented me from doing so)

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@staskus
Copy link
Contributor Author

staskus commented Oct 7, 2022

@crazytonyli If you want and you can, feel free to take over this PR 👍 Thanks!

@staskus
Copy link
Contributor Author

staskus commented Oct 7, 2022

Also cherry-picked bundler fix #19409

@wpmobilebot
Copy link
Contributor

You can test the changes in Jetpack from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr19418-d1b46eb on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@wpmobilebot
Copy link
Contributor

You can test the changes in WordPress from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr19418-d1b46eb on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@crazytonyli
Copy link
Contributor

Oops, thanks for fix this! I'll have a quick look to see if this is something that the compiler should warn us.

@crazytonyli crazytonyli merged commit 838058f into release/20.9 Oct 9, 2022
@crazytonyli crazytonyli deleted the fix/19413-crash-on-tapping-account-settings-menu-for-accounts-with-no-sites branch October 9, 2022 20:45
@mokagio
Copy link
Contributor

mokagio commented Oct 12, 2022

@staskus this has been bundled as part of 20.9 beta 1 (20.9.0.1).

Thanks for your work 🙌

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

Successfully merging this pull request may close these issues.

4 participants