wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.92k stars 1.3k forks source link

Fixes: NullPointerException in SiteCreationActivity #20652

Closed pantstamp closed 4 weeks ago

pantstamp commented 4 weeks ago

Fixes #20647


This PR tries to fix sentry crash reported here.

The issue is in these lines:

supportFragmentManager.findFragmentByTag(JetpackFeatureFullScreenOverlayFragment.TAG)
                    as JetpackFeatureFullScreenOverlayFragment

findFragmentByTag() may return a null value and if we then try to cast null to JetpackFeatureFullScreenOverlayFragment, a NullPointerException is thrown.

I was not able to replicate the crash on my device but it seems that the approach of using savedInstanceState == null check does not work for all cases.

To Test:

  1. Install the WordPress apk from this PR.
  2. Log in and try to create a new site.
  3. When the overlay that promotes Jetpack app appears, rotate your device multiple times and check that no crash occurs.

Regression Notes

  1. Potential unintended areas of impact

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

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

    • N/A

PR Submission Checklist:


Testing Checklist (strike-out the not-applying and unnecessary ones):

sonarcloud[bot] commented 4 weeks ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

wpmobilebot commented 4 weeks ago
WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr20652-141f222
Commit141f222d3d022e5a59ee754c88963ccb5553edc6
Direct Downloadwordpress-prototype-build-pr20652-141f222.apk
Note: Google Login is not supported on these builds.
wpmobilebot commented 4 weeks ago
Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr20652-141f222
Commit141f222d3d022e5a59ee754c88963ccb5553edc6
Direct Downloadjetpack-prototype-build-pr20652-141f222.apk
Note: Google Login is not supported on these builds.
sentry-io[bot] commented 3 weeks ago

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

Did you find this useful? React with a 👍 or 👎