Skip to content

Fix crash in LineChartRenderer.swift when animating data set changes #5231

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Source/Charts/Renderers/LineChartRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,12 @@ open class LineChartRenderer: LineRadarRenderer

for high in indices
{
// When updating the data set for the chart and then animating it, sometimes highlights are generated for the
// removed sets. This guard prevents OOB in the case where the new set has less data than the old set
if high.dataSetIndex >= lineData._dataSets.count - 1 {
continue
}

guard let set = lineData[high.dataSetIndex] as? LineChartDataSetProtocol,
set.isHighlightEnabled
else { continue }
Expand Down