-allow UINT64_MAX without crashing
authorChristian Grothoff <christian@grothoff.org>
Wed, 11 Feb 2015 19:23:57 +0000 (19:23 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 11 Feb 2015 19:23:57 +0000 (19:23 +0000)
src/ats/gnunet-service-ats_normalization.c

index c10e5070f54372eac8f9bda941cadde11ba3f9bb..017e14327ecf380ef3b248180749cc875e47c3b2 100644 (file)
@@ -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;
 }