tolerate NULL handle
authorChristian Grothoff <christian@grothoff.org>
Fri, 19 Mar 2010 13:21:31 +0000 (13:21 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 19 Mar 2010 13:21:31 +0000 (13:21 +0000)
src/statistics/statistics_api.c

index 5c5588e918491c37475beeb3b775314be8befb10..48b038cfe51c35f46cf5e7e0b6f93c75aaecd48a 100644 (file)
@@ -789,6 +789,8 @@ GNUNET_STATISTICS_set (struct GNUNET_STATISTICS_Handle *handle,
                        const char *name,
                        uint64_t value, int make_persistent)
 {
+  if (handle == NULL)
+    return;
   GNUNET_assert (GNUNET_NO == handle->do_destroy);
   add_setter_action (handle, name, make_persistent, value, ACTION_SET);
 }
@@ -808,6 +810,10 @@ GNUNET_STATISTICS_update (struct GNUNET_STATISTICS_Handle *handle,
                           const char *name,
                           int64_t delta, int make_persistent)
 {
+  if (handle == NULL)
+    return;
+  if (delta == 0)
+    return;
   GNUNET_assert (GNUNET_NO == handle->do_destroy);
   add_setter_action (handle, name, make_persistent,
                      (unsigned long long) delta, ACTION_UPDATE);