Fix vote count crash

This commit is contained in:
Lumaa 2024-06-23 16:33:20 +02:00
parent 8857da5ad0
commit 0beb5fac87

View File

@ -21,7 +21,7 @@ struct PostPoll: View {
let index = poll.options.firstIndex(where: { $0.id == option.id })
let isMostVoted: Bool = self.isMostVoted(option: option)
let clamped: Double = Double(option.votesCount ?? 0) / Double(poll.safeVotersCount)
let clamped: Double = Double(option.votesCount ?? 0) / max(Double(poll.safeVotersCount), 1.0)
Button {
if !submitted && !poll.expired {