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

空指针异常 #143

Closed
ITRocker opened this issue Aug 23, 2018 · 1 comment · Fixed by #323
Closed

空指针异常 #143

ITRocker opened this issue Aug 23, 2018 · 1 comment · Fixed by #323
Assignees
Labels
Milestone

Comments

@ITRocker
Copy link

OkDownload Version

v1.0.3

Problem Describe

空指针异常应该是在多线程的情况下产生的,但目前不知道怎么修改。
不明白BlockInfo.getTotalLength 中为啥要做clone,直接遍历去长度不就可以了 。

Log

java.lang.NullPointerException: Attempt to invoke virtual method 'long com.liulishuo.okdownload.core.breakpoint.BlockInfo.d()' on a null object reference
at com.liulishuo.okdownload.core.breakpoint.BreakpointInfo.g(BreakpointInfo.java:143)
at com.liulishuo.okdownload.core.listener.assist.Listener1Assist$Listener1Model.onInfoValid(Listener1Assist.java:151)
at com.liulishuo.okdownload.core.listener.assist.Listener1Assist.a(Listener1Assist.java:62)
at com.liulishuo.okdownload.core.listener.DownloadListener1.downloadFromBeginning(DownloadListener1.java:77)
at com.liulishuo.okdownload.core.listener.DownloadListenerBunch.downloadFromBeginning(DownloadListenerBunch.java:66)
at com.liulishuo.okdownload.core.dispatcher.CallbackDispatcher$DefaultTransmitListener$4.run(CallbackDispatcher.java:248)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:232)
at android.app.ActivityThread.main(ActivityThread.java:6802)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1103)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

@rantianhua rantianhua self-assigned this Oct 16, 2019
@rantianhua rantianhua added the bug label Oct 16, 2019
@rantianhua rantianhua added this to the 1.0.6 milestone Oct 16, 2019
@rantianhua
Copy link
Collaborator

用 Clone 是为了避免用锁做同步降低性能,不过因为 clone 本身也不是线程安全的,所以出现这个问题。

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

Successfully merging a pull request may close this issue.

2 participants