-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Comments
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. |
I'm still facing this issue. Is this going to be resolved? |
first we need to know why it's oob. Empty data set should not go that far |
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. |
no update for half year. closing |
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]
}
The text was updated successfully, but these errors were encountered: