Fix TrendHistoryView trying to create shape layers with NaNs

This commit is contained in:
Shadowfacts 2023-02-25 15:11:17 -05:00
parent 18bc6ce61e
commit ab17a688cf
1 changed files with 3 additions and 0 deletions

View File

@ -48,6 +48,9 @@ class TrendHistoryView: UIView {
} }
let maxUses = history.max(by: { $0.uses < $1.uses })!.uses let maxUses = history.max(by: { $0.uses < $1.uses })!.uses
guard maxUses > 0 else {
return
}
// remove old layers if this view is being re-used // remove old layers if this view is being re-used
layer.sublayers?.forEach { $0.removeFromSuperlayer() } layer.sublayers?.forEach { $0.removeFromSuperlayer() }