Skip to content

Attempt to invoke virtual method 'boolean android.os.HandlerThread.isAlive()' #237

@justinjoyn

Description

@justinjoyn

Describe the bug
A clear and concise description of what the bug is.

On Android devices, the app crashes with following error:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.os.HandlerThread.isAlive()' on a null object reference
       at com.github.barteksc.pdfviewer.PDFView.loadComplete(PDFView.java:756)
       at com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:80)
       at com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:27)
       at android.os.AsyncTask.finish(AsyncTask.java:771)
       at android.os.AsyncTask.access$900(AsyncTask.java:199)
       at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:344)
       at android.app.ActivityThread.main(ActivityThread.java:8248)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:589)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1071)

To Reproduce

  • I checked the demo project and cannot reproduce the issue
  • I checked the demo project and the issue exists

Steps to reproduce the behavior:

  1. Open a screen with the PDFView component which has a resource set as a remote URL.
  2. Navigate away form the screen before the file loads.

Expected behavior
Handle onLoad even after navigating away from the screen with PDFView component

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: Motorola G60
  • OS: Android
  • Android Version 12

Additional context
Here are the related dependencies and their versions on our app.

        "@react-navigation/bottom-tabs": "6.3.3",
        "@react-navigation/native": "6.0.12",
        "@react-navigation/native-stack": "6.8.0",
        "react": "17.0.2",
        "react-native": "0.67.4",
        "react-native-view-pdf": "0.14.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions