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

fatal error: Index out of range #2109

Closed
nandawys opened this issue Jan 24, 2017 · 5 comments
Closed

fatal error: Index out of range #2109

nandawys opened this issue Jan 24, 2017 · 5 comments

Comments

@nandawys
Copy link

image

Empty dataSet cause this crash.
So I have to add this judge statement. It works, but I'm not sure what's behind this ...

open override func entryForIndex(_ i: Int) -> ChartDataEntry?
{
if _values.count < i + 1 {
return nil
}
return _values[i]
}

@pmairoldi
Copy link
Collaborator

I agree that this function could be better. Since it returns an optional the check should be done in the function. I believe that the actual intent is that the function should be marked as throws and the return type should not be optional.

@AtharvaVaidya
Copy link

I'm still facing this issue. Is this going to be resolved?

@liuxuan30
Copy link
Member

liuxuan30 commented Mar 14, 2017

first we need to know why it's oob. Empty data set should not go that far
most of the time it's guarded, so should be fine. Where did it crash exactly?

@jjatie
Copy link
Collaborator

jjatie commented Jul 19, 2017

Given Swift Arrays expect the user to either check that the index is within bounds, that the Charts API should do the same. This allows the DataSet to return a non-optional ChartDataEntry.

@liuxuan30
Copy link
Member

no update for half year. closing

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

No branches or pull requests

5 participants