Skip to content

Commit 31dd1a5

Browse files
committed
Fixed possible out-of-bounds exception when no ranges are present
1 parent 530cbab commit 31dd1a5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Charts/Classes/Highlight/BarChartHighlighter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ internal class BarChartHighlighter: ChartHighlighter
169169
}
170170
}
171171

172-
let length = ranges!.count - 1
172+
let length = max(ranges!.count - 1, 0)
173173

174174
return (value > ranges![length].to) ? length : 0
175175
}

0 commit comments

Comments
 (0)