0xpr03 / VocableTrainer-Android

Vocabulary Trainer for Android - not lang specific
Apache License 2.0
29 stars 10 forks source link

Crash when finishing a resumed training session #74

Closed 0xpr03 closed 2 years ago

0xpr03 commented 2 years ago

Acra report

D/TrainerActivity(21334): init fragments
W/FragmentActivity(21334): trueTrainerQuickFragment{48977e} (88bc2af8-c821-4f67-a86a-4a9c0a7a07a1 id=0x7f0900f0)
D/TQuickFragment(21334): showVocable
D/TrainerActivity(21334): post create
D/Trainer (21334): getSolutionUncounted
D/TQuickFragment(21334): showNextVocable(correct:true)
D/Trainer (21334): accountVocable(correct:true)
java.lang.NullPointerException: Attempt to invoke virtual method 'void vocabletrainer.heinecke.aron.vocabletrainer.lib.Database.insertEntryStat(long, vocabletrainer.heinecke.aron.vocabletrainer.lib.Storage.VEntry, boolean, boolean)' on a null object reference
    at vocabletrainer.heinecke.aron.vocabletrainer.lib.Trainer.Trainer.accountVocable(Trainer.java:329)
    at vocabletrainer.heinecke.aron.vocabletrainer.lib.Trainer.Trainer.updateVocable(Trainer.java:359)
    at vocabletrainer.heinecke.aron.vocabletrainer.fragment.TrainerQuickFragment.showNextVocable(TrainerQuickFragment.java:63)
    at vocabletrainer.heinecke.aron.vocabletrainer.fragment.TrainerQuickFragment.lambda$onCreateView$1(TrainerQuickFragment.java:50)
    at vocabletrainer.heinecke.aron.vocabletrainer.fragment.TrainerQuickFragment.$r8$lambda$C_hHhF6ZLxDXRAv5Q8p2nW7vhUc(Unknown Source:0)
    at vocabletrainer.heinecke.aron.vocabletrainer.fragment.TrainerQuickFragment$$ExternalSyntheticLambda1.onClick(Unknown Source:2)
    at android.view.View.performClick(View.java:7448)
    at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:1119)
    at android.view.View.performClickInternal(View.java:7425)
    at android.view.View.access$3600(View.java:810)
    at android.view.View$PerformClick.run(View.java:28305)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7664)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
mawoka-myblock commented 2 years ago

Acra requires a login

0xpr03 commented 2 years ago

Acra requires a login

That's correct, the relevant stuff is in the issue.

0xpr03 commented 2 years ago

This issue is odd. For some reason the Database is null, even though it's initialized in the constructor. If somebody can tell me how they triggered this, that'd be awesome.

0xpr03 commented 2 years ago

I may have been able to reproduce this after a private report. It's definitely tricky to trigger and worked with

0xpr03 commented 2 years ago

I was able to reproduce a different state loss, after 20 minutes of trying, it all boils down to switching the view, going into lockscreen and resume a session. I wasn't able to repeat it. Apparently it can happen that each and every state is null after this combination.. Could be related to the lifecycle changes in recent android versions.

0xpr03 commented 2 years ago

Easy reproduction:

Apparently the list of the entry is loosing it's "unsolved" count, leading to the default of -1, leading to isFinished always returning true, so the training doesn't end (and fails to load the next entry).

0xpr03 commented 2 years ago

Fixed in 0.8.1, currently on its way through the f-droid release train