Skip to content

Commit 58ffd57

Browse files
Merge pull request #2 from WalletSaver/HotFix1
Fix crash when the value of max and min value are equal.
2 parents ebbf347 + f33e51f commit 58ffd57

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Source/LinearProgressView.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ open class LinearProgressView: UIView {
115115
super.layoutSubviews()
116116

117117
let maxWidth: CGFloat = max(self.frame.width - barInset * 2, 0) //prevent from becoming negative
118-
let calculatedWidth: CGFloat = CGFloat((progress - minimumValue) / (maximumValue - minimumValue)) * maxWidth
119-
118+
let calculatedWidth: CGFloat = maximumValue - minimumValue != 0 ? CGFloat((progress - minimumValue) / (maximumValue - minimumValue)) * maxWidth : 0
120119
trackViewWidthConstraint.constant = calculatedWidth
121120
if isCornersRounded {
122121
self.layer.cornerRadius = self.frame.height / 2

0 commit comments

Comments
 (0)