NoteCrypt icon indicating copy to clipboard operation
NoteCrypt copied to clipboard

NullPointerException when accessing the DB

Open RyuzakiKK opened this issue 7 years ago • 0 comments

I received a few reports similar to this one:

java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2778)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2856)
  at android.app.ActivityThread.-wrap11 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1589)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6494)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:438)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:807)
Caused by: java.lang.NullPointerException: 
  at com.notecrypt.ui.ReadNoteActivity.onCreate (ReadNoteActivity.java:49)
  at android.app.Activity.performCreate (Activity.java:7009)
  at android.app.Activity.performCreate (Activity.java:7000)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1214)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2731)

So apparently the problem lays here https://github.com/RyuzakiKK/NoteCrypt/blob/78f7ad1fd1b13a895f29daa6e53cb353c967cfd3/app/src/main/java/com/notecrypt/ui/ReadNoteActivity.java#L49

The db variable should not be null because it is initialized before we reach the ReadNoteActivity https://github.com/RyuzakiKK/NoteCrypt/blob/cfbfd3e2528a0256d3f8d087798b7914c6931a5a/app/src/main/java/com/notecrypt/utils/CryptoLoad.java#L180

I need to check more closely what is causing this bug, and right now I'm unable to reproduce it.

RyuzakiKK avatar Sep 05 '18 07:09 RyuzakiKK