mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
- fix out of bounds when changing to the chart widget (happens only when empty history)
This commit is contained in:
@@ -251,7 +251,9 @@ public class LineChart: Widget {
|
||||
public override func setValues(_ values: [value_t]) {
|
||||
let historyValues = values.map{ $0.widget_value }.suffix(60)
|
||||
let end = self.chart.points!.count
|
||||
self.chart.points!.replaceSubrange(end-historyValues.count...end-1, with: historyValues)
|
||||
if historyValues.count != 0 {
|
||||
self.chart.points!.replaceSubrange(end-historyValues.count...end-1, with: historyValues)
|
||||
}
|
||||
self.display()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user