wordpress-mobile / WordPress-Login-Flow-Android

Pluggable WordPress login flow for Android
GNU General Public License v2.0
14 stars 3 forks source link

Use non-nullable boolean #69

Closed malinajirka closed 2 years ago

malinajirka commented 2 years ago

This PR fixes a NPE introduced in this PR.

We were using java's nullable Boolean instead of non-nullable boolean. When we tried to store this value into a bundle, the app crashed with NPE as Bundle.putBoolean accepts boolean so when we pass a null Boolean the automatic cast results in NPE.

Test in WCAndroid:

  1. Clear app data
  2. Enable Do not keep activities in developer settings
  3. Click on the Login with site address.
  4. Tap no the home button and bring the app back to foreground - notice it doesn't crash

cc @jkmassel ~@AliSoftware~ ~Unfortunately, this bug affects both WPAndroid and WCAndroid 😞.~ (Update: I take that back, it seems that WPAndroid still uses v0.0.4 so this bug affects only WCAndroid). I've created release/0.0.6 branch to make sure we don't merge any other changes into the beta release. Having said that, if you prefer to merge this PR directly into develop, feel free to do so.

anitaa1990 commented 2 years ago

@malinajirka should I just merge this PR to release/0.006 or should we wait for @jkmassel to confirm?

malinajirka commented 2 years ago

@anitaa1990 I'd suggest waiting for Jeremy. Thank you so much for the review and reporting this issue! ;)

AliSoftware commented 2 years ago

Just to be extra extra sure, was it confirmed/tested that this doesn't affect WPAndroid but only WC?

malinajirka commented 2 years ago

@AliSoftware I'm 100% sure the issue was introduced in this PR which was introduced in v0.0.6. So if WPAndroid is still on v0.0.4 the WPAndroid is not affected. But I can re-test it if you'd feel safer, just let me know.

AliSoftware commented 2 years ago

Thanks for double-checking @malinajirka 👍

I confirm that the release/18.4 as well as develop for WPAndroid both still use WordPress Login lib version 0.0.4, so we're all good for WPAndroid then 👍