From f68fa94ece631b0399184631ba8aea6d71634c6c Mon Sep 17 00:00:00 2001 From: Ivan Borshukov Date: Tue, 28 Feb 2017 10:00:13 +0200 Subject: [PATCH] mozzle: Avoid division by zero --- metric.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/metric.go b/metric.go index 7d9187c..fff41d4 100644 --- a/metric.go +++ b/metric.go @@ -39,6 +39,9 @@ func forApp(app application, m Metric) Metric { } func ratio(part, whole uint64) float64 { + if whole == 0 { + return 0.0 + } return float64(part) / float64(whole) }