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

LineChart crashes if no entries #496

Closed
jwardle opened this issue Oct 23, 2015 · 1 comment
Closed

LineChart crashes if no entries #496

jwardle opened this issue Oct 23, 2015 · 1 comment

Comments

@jwardle
Copy link

jwardle commented Oct 23, 2015

Instead of showing the 'no data available' perspective of the chart, with version 2.1.5 of Charts the view now crashes when there are no data items to be shown...when the chart is instructed to draw the circles on the line (the no data available view shows correctly if drawCirclesEnabled = false).

LineChartRenderer.drawCircles() is the culprit, particularly the forced unwrap on the following line within drawCircles()

let entryFrom = dataSet.entryForXIndex(_minX)!

This can be protected against by adjusting the test above this line to include a check for 0 data entries:

if (!dataSet.isVisible || !dataSet.isDrawCirclesEnabled || dataSet.entryCount == 0)
 {
       continue
 }
@danielgindi
Copy link
Collaborator

Thanks!!! :-)

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