-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
When using RadarChartView (version 5.1.0) and enabling accessibility support, the chart’s internal renderer attempts to read from its accessibilityAxisLabelValueTuples array at an index that doesn’t exist, triggering a Swift “Index out of range” crash:
Thread 1: Fatal error: Index out of range
Swift/ContiguousArrayBuffer.swift:690
let accessibilityLabel = accessibilityAxisLabelValueTuples[j].0
This happens in RadarChartRenderer.drawDataSet(context:dataSet:index:), where the code assumes that the tuples array always has one entry per slice. In fact, under certain data configurations (for example, when custom accessibility entry labels are not provided or the chart has been redrawn), accessibilityAxisLabelValueTuples can be shorter than the number of data points, and no bounds check is performed before subscripting.
Expected Behavior:
The renderer should guard against out-of-bounds access. Possible fixes include:
Before subscripting, check j < accessibilityAxisLabelValueTuples.count;
Or, initialize accessibilityAxisLabelValueTuples in sync with the number of slices;
Or, fall back to a default label/value when no tuple exists for that index.
Environment:
Charts version: 5.1.0 (via CocoaPods / SPM / Carthage)
Xcode: 15.3
iOS SDK: iOS 18.4
Please let me know if you need any additional information or a minimal sample project. Thanks for maintaining Charts!