summaryrefslogtreecommitdiff
path: root/src/nat-auto
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-10 17:25:16 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-10 17:25:16 +0100
commit30d691f576a7c1327cfd88269aa025747aee6083 (patch)
tree45dd51c62222a565cbe08ac7f84e3961935e8d51 /src/nat-auto
parentadc35f6e82c099c1906d3fbbd2b4444b77a48e26 (diff)
handle case 'diff' is NULL - fixes NPE
Diffstat (limited to 'src/nat-auto')
-rw-r--r--src/nat-auto/gnunet-nat-auto.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/nat-auto/gnunet-nat-auto.c b/src/nat-auto/gnunet-nat-auto.c
index 9ba81eb5f..5eb0a4be3 100644
--- a/src/nat-auto/gnunet-nat-auto.c
+++ b/src/nat-auto/gnunet-nat-auto.c
@@ -174,6 +174,9 @@ auto_config_cb (void *cls,
GNUNET_NAT_AUTO_status2string (result),
nat_type);
+ if (NULL == diff)
+ return;
+
/* Shortcut: if there are no changes suggested, bail out early. */
if (GNUNET_NO ==
GNUNET_CONFIGURATION_is_dirty (diff))
@@ -186,20 +189,16 @@ auto_config_cb (void *cls,
to the user */
new_cfg = write_cfg ? GNUNET_CONFIGURATION_dup (cfg) : NULL;
- if (NULL != diff)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
- _("Suggested configuration changes:\n"));
- GNUNET_CONFIGURATION_iterate_section_values (diff,
- "nat",
- &auto_conf_iter,
- new_cfg);
- }
+ GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+ _("Suggested configuration changes:\n"));
+ GNUNET_CONFIGURATION_iterate_section_values (diff,
+ "nat",
+ &auto_conf_iter,
+ new_cfg);
/* If desired, write configuration to file; we write only the
changes to the defaults to keep things compact. */
- if ( (write_cfg) &&
- (NULL != diff) )
+ if (write_cfg)
{
struct GNUNET_CONFIGURATION_Handle *def_cfg;
@@ -298,8 +297,8 @@ run (void *cls,
if (do_auto)
{
ah = GNUNET_NAT_AUTO_autoconfig_start (c,
- &auto_config_cb,
- NULL);
+ &auto_config_cb,
+ NULL);
}
if (use_tcp && use_udp)