Fix/9748 npe in EditPostActivity onPrepareOptionsMenu #10534
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.
Fixes #9748
The issue is confined to Android 8.0.0 and does not seems to be logic related.
It was not possible to reproduce the issue, but we decided to extend the defensive coding approach used in
null
check of all the other menu items in theonPrepareOptionsMenu
also to theswitchToAztecMenuItem
andswitchToGutenbergMenuItem
. Note that the NPE happens onswitchToAztecMenuItem
that is the first not null checked item.Notes
onOptionsItemSelected
. This is a basic attempt to avoid odd conditions where a switch menu is available when it should not and you should not be allowed to switch between editors (AFAIU basically a post/page created in Aztec should not be allowed to be edited in GB; whereas a post/page created in GB can be edited with Aztec but the underline document will for now on contain blocks)Manual testing
The following test cases must be completed with and without the current PR patch and give the same results.
Test case 1 - Use block editor settings
Test case 2 - Use block editor settings
Test case 3 - From Aztec no GB
Test case 4 - From GB to Aztec and return
Test case 5 - General smoke test on Editor and Menu items
Update release notes:
RELEASE-NOTES.txt
if necessary.