-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
check null to solve crash #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @YOEL311, thanks for investigating and putting up a PR!
I'll keep the guard statement which might protect against the NPE. 👍
This might stop crashes, but I have a feeling it will not fix the root issue and some of your users may not be able to load pdfs.
I took a look at the original repo and think that the issue is probably due to this
I'll implement the fix of moving thread creation from the constructor
into onAttachedToWindow
.
I am also a bit hesitant to integrate any of the gradle changes so I will likely leave those out for now.
- the thread creation and recycling was not being handled symmetrically - this fix is based off of these two PR: DImuthuUpe#824 and #2
I am going to close this for now. Hopefully the change here helps address the issue you were facing. |
Thanks, |
Fix a potential NPE due to out of sync render thread management [Pull Request](DImuthuUpe/AndroidPdfViewer#824) Update the sample app configuration so that it can compile [Pull Request](mhiew/AndroidPdfViewer#2)
- the thread creation and recycling was not being handled symmetrically - this fix is based off of these two PR: DImuthuUpe#824 and mhiew#2 ref: DImuthuUpe@41f912e
- the thread creation and recycling was not being handled symmetrically - this fix is based off of these two PR: DImuthuUpe#824 and mhiew#2 ref: DImuthuUpe/AndroidPdfViewer@41f912e
get crash
Android OS: 9<
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'boolean android.os.HandlerThread.isAlive()' on a null object reference
com.github.barteksc.pdfviewer.PDFView.loadComplete (PDFView.java:756)
com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute (DecodingAsyncTask.java:80)
com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute (DecodingAsyncTask.java:27)
android.os.AsyncTask.finish (AsyncTask.java:755)
android.os.AsyncTask.access$900 (AsyncTask.java:192)
android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:772)
android.os.Handler.dispatchMessage (Handler.java:107)
android.os.Looper.loop (Looper.java:237)
android.app.ActivityThread.main (ActivityThread.java:8167)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:496)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1100)