Sentry Url: https://sentry.io/share/issue/f8446ccce4b44145a970421331426f4f/
User Count: 8
Count: 8
First Release: org.wordpress.[email protected]+885
First Seen: 2020-07-01T01:00:06.894000Z
Last Seen: 2020-07-03T05:00:21Z
24 Hours: 7
30 Days: 8
NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getString(int)' on a null object reference
at org.wordpress.android.ui.prefs.SiteSettingsInterface.loadCachedSettings(SiteSettingsInterface.java:1072)
at org.wordpress.android.ui.prefs.SiteSettingsInterface.init(SiteSettingsInterface.java:998)
at org.wordpress.android.ui.publicize.PublicizeButtonPrefsFragment.lambda$getSiteSettings$2(PublicizeButtonPrefsFragment.java:317)
at org.wordpress.android.ui.publicize.-$$Lambda$PublicizeButtonPrefsFragment$zgqQzY4Y2akf99aaj80pPoNLyJM.run(null:2)
...
(1 additional frame(s) were not displayed)
This NPE has about 60 users since Jun 30, 2020. Is this a reoccurance of #6915? Adding to groundskeeping.
I looked into this and I have a good news and an awesome news 馃槃 .
I think this happens because (following links are from 16.1 version) in PublicizeButtonPrefsFragment we call a postDelayed
new Handler().postDelayed(() -> mSiteSettings.init(true), FETCH_DELAY);
where the init function calls the SiteSettingsInterface -> loadCachedSettings in which we reference an mContext that can eventually been set to null in the clear function before the init is actually scheduled. It's not the only path I think, but one way I found to trigger this is the following (tested with 16.1):
Sharing then tap on Manage. Note you are landed back into My Site and you get the crash (it could take few seconds).I have a fix for it, but remember, I also have an awesome news, so go ahead reading 馃槃
I think the issue is fixed by a modification that maybe was not done to target this issue specifically but that is already merged into current develop (and landing in the 16.3 upcoming release). This happens because we use an injectable ResourceProvider instead of using the Context directly. (cc @planarvoid who I think worked on that. Funny thing is I was going with a pretty similar solution 馃槣 ).
Hey @designsimply , I think I would not do any additional modification. I would continue monitoring the issue and if the above assumption is correct we should not see this issue from 16.3 on and we can close the isse. If we still see that, well...well we should review the assumption and further dig into it 馃檭 , let me know wdyt.
Note for myself: I actually already know this but always good to repeat to myself. If you find a way to replicate with the version(s) from the issue, before you define a solution check the develop! 馃槃
sgtm! thank you for the excellent notes and explanation!
I checked in on this crash today and found that there were no new events recorded for it in v16.3+. 馃帀"
Recommend closing.
Most helpful comment
I checked in on this crash today and found that there were no new events recorded for it in v16.3+. 馃帀"
Recommend closing.