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 BlazeViewModel #20716

Closed pantstamp closed 2 weeks ago

pantstamp commented 2 weeks ago

Fixes #20644 This PR tries to fix the NullPointerException that is described on the above ticket.

To Test:

  1. Enable Developer options on your device
  2. Go to Developer Options → Background Process limit → Set 1 as background process limit
  3. Install a build from the trunk
  4. Go to Pages screen
  5. Pick a page and tap on the menu button (three dots menu)
  6. Tap on "Promote with Blaze"
  7. Wait for the blaze screen to load
  8. Move the app to background and use 2+ other apps
  9. Launch the app from app launcher
  10. Verify that you see the crash in your LogCat

FATAL EXCEPTION: main Process: com.jetpack.android.prealpha, PID: 17395 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jetpack.android.prealpha/org.wordpress.android.ui.blaze.blazepromote.BlazePromoteParentActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3822) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3963) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2468) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:205) at android.os.Looper.loop(Looper.java:294) at android.app.ActivityThread.main(ActivityThread.java:8248) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)

  1. Check out this PR's branch
  2. Follow again steps 4-9
  3. Verify that you don't see the crash in your LogCat and you end up in the pages list screen

Regression Notes

  1. Potential unintended areas of impact

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

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

    • Relied on existing tests

PR Submission Checklist:


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

dangermattic commented 2 weeks ago
1 Warning
:warning: This PR is assigned to the milestone 24.8. This milestone is due in less than 4 days.
Please make sure to get it merged by then or assign it to a milestone with a later deadline.

Generated by :no_entry_sign: Danger

wpmobilebot commented 2 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
Versionpr20716-dbffad1
Commitdbffad1b425b179ebbe719787ea22a141f9f149a
Direct Downloadjetpack-prototype-build-pr20716-dbffad1.apk
Note: Google Login is not supported on these builds.
wpmobilebot commented 2 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
Versionpr20716-dbffad1
Commitdbffad1b425b179ebbe719787ea22a141f9f149a
Direct Downloadwordpress-prototype-build-pr20716-dbffad1.apk
Note: Google Login is not supported on these builds.
codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 90.90909% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 40.63%. Comparing base (5efa916) to head (dbffad1).

Files Patch % Lines
...ss/android/ui/blaze/blazeoverlay/BlazeViewModel.kt 90.90% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## trunk #20716 +/- ## ======================================= Coverage 40.62% 40.63% ======================================= Files 1485 1485 Lines 68330 68336 +6 Branches 11302 11304 +2 ======================================= + Hits 27760 27765 +5 Misses 38054 38054 - Partials 2516 2517 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

sonarcloud[bot] commented 2 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