Skip to content
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

NullPointerException in PDFView.loadComplete #1

Closed
madmas opened this issue Aug 4, 2020 · 8 comments
Closed

NullPointerException in PDFView.loadComplete #1

madmas opened this issue Aug 4, 2020 · 8 comments

Comments

@madmas
Copy link

madmas commented Aug 4, 2020

After loading an PDF, I get this exception:

System.err: An uncaught Exception occurred on "main" thread.
System.err: Attempt to invoke virtual method 'boolean java.lang.Thread.isAlive()' on a null object reference
System.err: 
System.err: StackTrace:
System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Thread.isAlive()' on a null object reference
System.err: 	at com.github.barteksc.pdfviewer.PDFView.loadComplete(PDFView.java:756)
System.err: 	at com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:80)
System.err: 	at com.github.barteksc.pdfviewer.DecodingAsyncTask.onPostExecute(DecodingAsyncTask.java:27)
System.err: 	at android.os.AsyncTask.finish(AsyncTask.java:667)
System.err: 	at android.os.AsyncTask.-wrap1(AsyncTask.java)
System.err: 	at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:684)
System.err: 	at android.os.Handler.dispatchMessage(Handler.java:102)
System.err: 	at android.os.Looper.loop(Looper.java:241)
System.err: 	at android.app.ActivityThread.main(ActivityThread.java:6274)
System.err: 	at java.lang.reflect.Method.invoke(Native Method)
System.err: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

From my point of view this state should not be possible as the referenced object is initialized in the constructor - but, it is.

@madmas
Copy link
Author

madmas commented Aug 5, 2020

@TalbotGooday Thank a lot for the suggestion, I treid to patch it as well but inserted

 if(renderingHandlerThread == null){
            renderingHandlerThread = new HandlerThread("PDF renderer");
        }

instead of a return to re-initialize it as it is initialized in the constructor.
I was able to verify it in the context the error occured for me and it worked fine - do you want a PR for it or do you have thoughts about it?

@TalbotGooday
Copy link
Owner

@madmas Please, create a PR. I can't fix this now 'cause I want to refactor the library on which based this one. I need some time to figure out how to build native code)

@madmas
Copy link
Author

madmas commented Aug 7, 2020

@TalbotGooday here it is ;-) I would be great if you can forge a release after it is merged 😇

@TalbotGooday
Copy link
Owner

@madmas Thank you) I'll try to make a release ASAP)

@TalbotGooday
Copy link
Owner

Merged, fixed, released. Version 3.1.0-beta.3 is waiting for you

@madmas
Copy link
Author

madmas commented Aug 11, 2020

@TalbotGooday it looks to me like something went wrong with the release :( I cannot get it from https://jitpack.io/com/github/TalbotGooday/AndroidPdfViewer/3.1.0-beta.3/ - does it work for you?

@TalbotGooday
Copy link
Owner

@madmas Yeah. There was some kind of a bug with the jitpack. Try again now

@madmas
Copy link
Author

madmas commented Aug 11, 2020

@TalbotGooday thanks a lot, works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants