Anki-android: crash when there is no card to preview

Created on 11 Dec 2019  路  6Comments  路  Source: ankidroid/Anki-Android

Reproduction Steps
  1. Tap 'card browser'
  2. Tap 'more options'
  3. Tap 'preview' when there is no card or when no card exists after filtering
Expected Result

Some information

Actual Result

Performing stop of activity that is not resumed: {com.ichi2.anki/com.ichi2.anki.CardBrowser}
java.lang.RuntimeException: Performing stop of activity that is not resumed: {com.ichi2.anki/com.ichi2.anki.CardBrowser}
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:3133)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:3220)
at android.app.ActivityThread.access$1100(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1223)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)

Debug info

Refer to the support page if you are unsure where to get the "debug info".
AnkiDroid Version = 2.9alpha25

Android Version = 4.4.4

ACRA UUID = aafe0f30-e91d-4478-9f8e-310ab576ea9b

Research

Enter an [ x ] character to confirm the points below:

[ x ] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid

[ x ] I have checked the manual and the FAQ and could not find a solution to my issue

[ x ] I have searched for similar existing issues here and on the user forum

2.9.x Bug Priority-Medium

Most helpful comment

This has been fixed in later version. @david-allison-1

All 6 comments

This issue can also be reproduced in Android 7.1.1.

Stack Trace:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ichi2.anki, PID: 1537
java.lang.RuntimeException: Unable to destroy activity {com.ichi2.anki/com.ichi2.anki.Previewer}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.ViewGroup.removeAllViews()' on a null object reference
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4203)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4221)
at android.app.ActivityThread.-wrap6(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1538)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.ViewGroup.removeAllViews()' on a null object reference
at com.ichi2.anki.AbstractFlashcardViewer.onDestroy(AbstractFlashcardViewer.java:924)
at android.app.Activity.performDestroy(Activity.java:6881)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1153)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4190)

Screen Shot:

image

Do you consider this as a defect?

Definitely a defect, and crash bugs are my favorite things to fix, but I haven't been able to get to it with time available yet, and neither have others unfortunately.

I really appreciate the stack traces though, those are gold for fixing things

On v2.9.1 there is no option anymore to preview when there are no cards.

Hello 馃憢, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like _still searching for solutions_ and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@anlalalu, can you still reproduce this?

This has been fixed in later version. @david-allison-1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

david-allison-1 picture david-allison-1  路  5Comments

mikehardy picture mikehardy  路  4Comments

littlefoodt picture littlefoodt  路  4Comments

david-allison-1 picture david-allison-1  路  4Comments

Mornon picture Mornon  路  5Comments