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

A "divide by 0" bug #952

Closed
lionhylra opened this issue Apr 15, 2016 · 3 comments
Closed

A "divide by 0" bug #952

lionhylra opened this issue Apr 15, 2016 · 3 comments

Comments

@lionhylra
Copy link

lionhylra commented Apr 15, 2016

In the file ChartYAxisRenderer.swift, line 136 : There is a small chance that the interval is 0(e.g. I set rightYAxis.granularity = 0.001 or a smaller number).

I recommend adding guard interval != 0 else {return} at line 136 .

Otherwise it might cause error when calculating last which finally crash app.

Screenshot

@danielgindi
Copy link
Collaborator

The problem seems to actually be the interval of the for-loop. It should be converted to a stride

@lionhylra
Copy link
Author

lionhylra commented Apr 16, 2016

Even when the for loop is converted to a stride, if the interval is 0, then first and last will become "NaN" which break the stride leading to a crash

@danielgindi
Copy link
Collaborator

This does not happen anymore with the latest changes, you can checkout the code from master.

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