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

java.lang.ArithmeticException: divide by zero #14

Closed
chowaikong opened this issue Dec 20, 2016 · 3 comments
Closed

java.lang.ArithmeticException: divide by zero #14

chowaikong opened this issue Dec 20, 2016 · 3 comments

Comments

@chowaikong
Copy link

当第一列数据滑到最底部时会崩,错误:

java.lang.ArithmeticException: divide by zero                                                                        
at com.weidongjian.meitu.wheelviewdemo.view.LoopView.onDraw(LoopView.java:298)
@imkarl
Copy link
Owner

imkarl commented Dec 20, 2016

LoopView第298行代码如下:
preCurrentIndex = initPosition + change % items.size();
出现算术错误,只能是items.size()为0的情况。

如果你能提供简单的Demo最好了,可以方便我检查是否控件内部的问题�引起的该错误。

@chowaikong
Copy link
Author

你可能没有考虑到第二或第三列可能没有数据的情况,在这里加个判断 items.size() > 0 就好了。

@imkarl
Copy link
Owner

imkarl commented Dec 20, 2016

多谢建议,代码�已更新

@imkarl imkarl closed this as completed Feb 4, 2017
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