Skip to content

Commit 4b916c3

Browse files
committed
[#1839] Fix division by zero
1 parent cef9e6a commit 4b916c3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

backend/util/bigcounter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ func (n *BigCounter) DivideBy(other *BigCounter) float64 {
159159
func (n *BigCounter) DivideSafeBy(other *BigCounter) float64 {
160160
if !other.isExtended() && other.base == 0 {
161161
return 0.0
162+
} else if other.isExtended() && other.extended.Cmp(big.NewInt(0)) == 0 {
163+
return 0.0
162164
}
163165
return n.DivideBy(other)
164166
}

0 commit comments

Comments
 (0)