summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-11 19:23:57 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-11 19:23:57 +0000
commitb290ee86db69a066fa6dc1348adead95fca25ad8 (patch)
treefef26fdea3d28193d4aca0b8248d6921589be62b /src
parent72002c196893a932c5f3bcdde818581a6209d4c9 (diff)
-allow UINT64_MAX without crashing
Diffstat (limited to 'src')
-rw-r--r--src/ats/gnunet-service-ats_normalization.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ats/gnunet-service-ats_normalization.c b/src/ats/gnunet-service-ats_normalization.c
index c10e5070f..017e14327 100644
--- a/src/ats/gnunet-service-ats_normalization.c
+++ b/src/ats/gnunet-service-ats_normalization.c
@@ -85,8 +85,10 @@ update_avg (uint64_t current_val,
sum += (double) ni->atsi_abs[c1];
}
}
- GNUNET_assert (0 != count);
- ni->avg = sum / count;
+ if (0 == count)
+ ni->avg = curent_val; /* must be UINT64_MAX */
+ else
+ ni->avg = sum / count;
}