The line that's failing has been last updated 2 years ago, but this issue started happening in the latest alpha/beta. (and it's the top crash for it)
Sentry Url: https://sentry.io/share/issue/518b348ef95844eca7ccc17717cfde3a/
User Count: 17
Count: 27
First Release: org.wordpress.android-14.9-rc-1
First Seen: 2020-05-20T00:49:43Z
Last Seen: 2020-05-22T00:56:06Z
24 Hours: 14
30 Days: 27
NullPointerException: Attempt to invoke virtual method 'boolean org.wordpress.android.ui.FilteredRecyclerView.isRefreshing()' on a null object reference
at org.wordpress.android.ui.reader.ReaderPostListFragment.onSaveInstanceState(ReaderPostListFragment.java:825)
at androidx.fragment.app.Fragment.performSaveInstanceState(Fragment.java:2766)
at androidx.fragment.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManagerImpl.java:2289)
at androidx.fragment.app.FragmentManagerImpl.saveAllState(FragmentManagerImpl.java:2348)
at androidx.fragment.app.FragmentController.saveAllState(FragmentController.java:151)
at androidx.fragment.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:513)
at androidx.appcompat.app.AppCompatActivity.onSaveInstanceState(AppCompatActivity.java:533)
at android.app.Activity.performSaveInstanceState(Activity.java:2041)
at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1507)
at android.app.ActivityThread.callActivityOnSaveInstanceState(ActivityThread.java:5539)
...
(13 additional frame(s) were not displayed)
Marking high priority as it's a new crash.
@ashiagr , can you please take a look at this?
I ran into this crash while testing https://github.com/wordpress-mobile/WordPress-Android/issues/12001, and there are steps, a video, and app logs on the issue.
(also see internal reference: p5T066-1jy-p2#comment-5006)
This crash seems to have started occurring after this fix: https://github.com/wordpress-mobile/WordPress-Android/pull/11927 was added in 14.9-rc-1.
(cc @malinajirka)
When toggling from Reader tab to My site tab, ReaderPostListFragment is detached but its state is still managed by the fragment manager according to FragmentTransaction detach (Fragment fragment) def. Its view hierarchy is destroyed though.
Detach the given fragment from the UI. This is the same state as when it is put on the back stack: the fragment is removed from the UI, however its state is still being actively managed by the fragment manager. When going into this state its view hierarchy is destroyed.
It is unsafe to access any of the view elements in the onSaveInstanceState of the detached fragment as was already accessed here before above fix was introduced.
I was able to reproduce this crash as follows:
detach._attach._onSaveStateInstance and if the detached fragment's view is garbage collected by this time, the view elements will be null._(Don't forget to disable "Don't keep activities" in step 1 after testing)
Fix could be to add a null check for the view element mRecyclerView on this line.
Note:
I ran into this crash while testing #12001, and there are steps, a video, and app logs on the issue.
Above crash is due to this sentry issue and should be investigated separately.
Awesome investigation @ashiagr!!! 馃檱 Thanks
I'll create a PR with a fix.
I think this bug is related to this discussion (change in appcompat 1.1.0) https://github.com/wordpress-mobile/WordPress-Android/pull/11292#pullrequestreview-358126779
This triggers Reader tab fragment's onSaveStateInstance and if the detached fragment's view is garbage collected by this time, the view elements will be null.
I believe the view isn't garbage collected. The issue is that "onCreateView" was never invoked for the fragment on a backstack. However, it doesn't change anything.
@ashiagr Friendly reminder to use the public urls for the Sentry crashes so it'd work for everyone. Re: https://github.com/wordpress-mobile/WordPress-Android/issues/11992#issuecomment-633472384
@malinajirka Since this is a new crash, assuming the fix is simple enough, I think you can target release/14.9 for it.
Fixed in #12018 (targeting v14.9).