-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
I found this while working on #10401. However, this is for a different crash.
Expected behavior
The editor should not crash on state restoration.
Actual behavior
The editor crashes when state is restored. Here is an excerpt of the crash:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.wordpress.android, PID: 20496
java.lang.NullPointerException: Attempt to invoke virtual method 'void org.wordpress.aztec.toolbar.AztecToolbar.enableMediaMode(boolean)' on a null object reference
at org.wordpress.android.editor.AztecEditorFragment.enableMediaMode(AztecEditorFragment.java:764)
at org.wordpress.android.ui.posts.EditPostActivity.hidePhotoPicker(EditPostActivity.java:1076)
at org.wordpress.android.ui.posts.EditPostActivity.access$400(EditPostActivity.java:197)
at org.wordpress.android.ui.posts.EditPostActivity$2.onPageSelected(EditPostActivity.java:586)
at androidx.viewpager.widget.ViewPager.dispatchOnPageSelected(ViewPager.java:1947)
at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:665)
at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:631)
at androidx.viewpager.widget.ViewPager.onRestoreInstanceState(ViewPager.java:1462)
Full crash log here: https://gist.github.com/shiki/75f404614649627389c139f08fc5b7a1.
Steps to reproduce
- Turn on Don't keep activities in the device's Developer Options.
- Run the app using the
release/13.1branch. - Edit a published post.
- Navigate to Options → History.
- While the History is open, place the app in the background.
- Open the app again. It will crash.
When you open the Post List again, you will find that the post will have an empty title and content. Loading the revision at this point will also crash the app.
Please see this video for how I reproduced it.
Findings
I could not reproduce this on release/13.0 so it seems this started to happen on release/13.1.
I ran git bisect from release/13.0 to release/13.1. The results say that 80321cb is the first bad commit.
80321cb2bee5d7b69ad550a199872b8467e5e581 is the first bad commit
commit 80321cb2bee5d7b69ad550a199872b8467e5e581
Date: Mon Jul 8 16:49:05 2019 +0200
Set published date from a new screen
:040000 040000 1a55a77ceac0470cc972f532840431aed3835f97 720f40e8b1a8c80db461d79a81cacd91a3bc5f0f M WordPress
That commit seems to have been merged in #10183. The commit before that, e3a9d9b, does not exhibit the crash. And the previous commit before it in relation to release/13.0, f76d724, also does not cause a crash.
The fix for the possibly related #10401, #10405, does not seem to fix this crash.
My git-fu is weak so I could be really wrong with these findings.
Test Info
Tested on Pixel 3, Android 9.0, WPAndroid release/13.1
@khaykov @planarvoid Is this caused by #10183?
cc @loremattei