Skip to content

Commit

Permalink
Prevent "maxNumSubviews" be negative number to cause crash
Browse files Browse the repository at this point in the history
  • Loading branch information
kf99916 committed Dec 9, 2020
1 parent ca4e7a1 commit 56dddbb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion TimelineTableViewCell/TimelineTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ open class TimelineTableViewCell: UITableViewCell {
open var bubbleColor = UIColor(red: 0.75, green: 0.75, blue: 0.75, alpha: 1.0)
open var bubbleEnabled = true

fileprivate lazy var maxNumSubviews = Int(floor(stackView.frame.size.width / (stackView.frame.size.height + stackView.spacing))) - 1
fileprivate lazy var maxNumSubviews = max(Int(floor(stackView.frame.size.width / (stackView.frame.size.height + stackView.spacing))) - 1, 0)

override open func awakeFromNib() {
super.awakeFromNib()
Expand Down

0 comments on commit 56dddbb

Please sign in to comment.