helloworld1 / AnyMemo

Advanced Spaced Repetition flashcard learning software for Android.
http://www.anymemo.org
GNU General Public License v2.0
151 stars 53 forks source link

Missing validation on db file #455

Open tianxiaogu opened 6 years ago

tianxiaogu commented 6 years ago

Reproduce:

  1. Create an invalid db file by adb shell touch /sdcard/test.db
  2. Launch the app and open the test.db.
  3. Click MORE on the imported test.db.
  4. Click Card player.
// java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Integer org.liberty.android.fantastischmemo.entity.Card.getId()' on a null object reference
//  at org.liberty.android.fantastischmemo.ui.CardPlayerActivity.bindCardPlayerService(CardPlayerActivity.java:213)
//  at org.liberty.android.fantastischmemo.ui.CardPlayerActivity.onPostInit(CardPlayerActivity.java:111)
//  at org.liberty.android.fantastischmemo.ui.QACardActivity$2.run(QACardActivity.java:648)
//  at android.os.Handler.handleCallback(Handler.java:739)
//  at android.os.Handler.dispatchMessage(Handler.java:95)
//  at android.os.Looper.loop(Looper.java:148)
//  at android.app.ActivityThread.main(ActivityThread.java:5417)
//  at java.lang.reflect.Method.invoke(Native Method)
//  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
//  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)