Skip to content

Commit 7d55d79

Browse files
authored
Merge pull request #6546 from woocommerce/crash/6333-log-stats-out-of-bound-info
Log info about stats intervals for x-axis labels when the index is out of bound to help with crash debugging
2 parents 1edd4b9 + a7d5e76 commit 7d55d79

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

WooCommerce/Classes/ViewRelated/Dashboard/Stats v4/StoreStatsV4PeriodViewController.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,12 @@ extension StoreStatsV4PeriodViewController: IAxisValueFormatter {
485485
}
486486

487487
if axis is XAxis {
488-
return createOrderStatsIntervalLabels()[Int(value)]
488+
let intervalLabels = createOrderStatsIntervalLabels()
489+
let index = Int(value)
490+
if index >= intervalLabels.count {
491+
DDLogInfo("🔴 orderStatsIntervals count: \(orderStatsIntervals.count); value: \(value); index: \(index); interval labels: \(intervalLabels)")
492+
}
493+
return intervalLabels[index]
489494
} else {
490495
if value == 0.0 {
491496
// Do not show the "0" label on the Y axis

0 commit comments

Comments
 (0)