[BUG]: Null DeckPicker reference in StudyOptionsFragment on tablets
Checked for duplicates?
- [x] This issue is not a duplicate
Does it also happen in the desktop version?
- [ ] This bug does not occur in the latest version of Anki Desktop
What are the steps to reproduce this bug?
Unclear, requires a tablet/ device with large screen.
Expected behaviour
No crash on tablets.
Debug info
Earliest report is from 2.19alpha10
(Optional) Anything else you want to share?
For the last couple of betas we had these reports on tablets where the reference to the DeckPicker ends up as null in StudyOptionsFragment. I presume this has something to do with the two pane layout that we use when the screen is big enough:
java.lang.NullPointerException: null cannot be cast to non-null type com.ichi2.anki.DeckPicker
at com.ichi2.anki.StudyOptionsFragment.getDeckPicker(SourceFile:7)
at com.ichi2.anki.StudyOptionsFragment$configureToolbarInternal$1.invokeSuspend(SourceFile:40)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:9)
at kotlinx.coroutines.DispatchedTask.run(SourceFile:107)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7399)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:502)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)
Several reports:
https://ankidroid.org/acra/app/1/bug/245801/report/38daceb2-c758-450f-a0ec-59a86b659cf9 https://ankidroid.org/acra/app/1/bug/245797/report/e45c35a1-001e-4543-865a-d9fe286153f2 https://ankidroid.org/acra/app/1/bug/246602/report/a5f8cc4a-e7a0-4cf7-ac48-2534ce725eda
I wasn't able to reproduce this on the emulator.
Research
- [x] I have checked the manual and the FAQ and could not find a solution to my issue
- [x] (Optional) I have confirmed the issue is not resolved in the latest alpha release (instructions)
Strange, scanning those I can say these things are not constant:
- API level (29, 33 and 34)
- language (ja_JP, en, en_US)
- orientation (landscape and portrait both)
- colorMode (5 and 10)
- screen size Width x Height (800x1208, 1152x680, 1049x862)
So it does not seem to matter what orientation or language or DPI or theme, it just has to be the fragmented / tablet / large layout
I think it's a race condition frankly - if you go to and from the deck picker quickly that would likely do it. Maybe load your machine down pretty heavily (like, run the lint checks) while trying to reproduce and maybe that would do it
Can we move a logcat trace to this issue (ideally with DEBUG logging enabled)?