do not put NULL block
authorChristian Grothoff <christian@grothoff.org>
Thu, 4 Jan 2018 21:37:20 +0000 (22:37 +0100)
committerChristian Grothoff <christian@grothoff.org>
Thu, 4 Jan 2018 21:37:20 +0000 (22:37 +0100)
src/regex/regex_internal_dht.c

index b80dabca0856b5ea982f6500a3665bd8db3de06c..828bb164893f677186c3d38d1e8a61791d6d1089 100644 (file)
@@ -154,23 +154,30 @@ regex_iterator (void *cls,
                     NULL, NULL);
   }
   block = REGEX_BLOCK_create (proof,
-                              num_edges, edges,
+                              num_edges,
+                             edges,
                               accepting,
                               &size);
-  (void)
-  GNUNET_DHT_put (h->dht, key,
-                  DHT_REPLICATION,
-                  DHT_OPT,
-                  GNUNET_BLOCK_TYPE_REGEX,
-                  size, block,
-                  GNUNET_TIME_relative_to_absolute (DHT_TTL),
-                  NULL, NULL);
+  if (NULL == block)
+    return;
+  (void) GNUNET_DHT_put (h->dht,
+                        key,
+                        DHT_REPLICATION,
+                        DHT_OPT,
+                        GNUNET_BLOCK_TYPE_REGEX,
+                        size,
+                        block,
+                        GNUNET_TIME_relative_to_absolute (DHT_TTL),
+                        NULL,
+                        NULL);
   GNUNET_STATISTICS_update (h->stats,
                             "# regex blocks stored",
-                            1, GNUNET_NO);
+                            1,
+                           GNUNET_NO);
   GNUNET_STATISTICS_update (h->stats,
                             "# regex block bytes stored",
-                            size, GNUNET_NO);
+                            size,
+                           GNUNET_NO);
   GNUNET_free (block);
 }