summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-02-18 14:05:32 +0000
committerChristian Grothoff <christian@grothoff.org>2015-02-18 14:05:32 +0000
commit433e2295e3f7fbb3e61b54489b9ee392914f3bff (patch)
tree0ea961f9e0916c077fe3934ea9b7009e3547e3a5 /src
parentc7e3322d889a8a759722a4ba03a4fbabcb561fd5 (diff)
-tolerate NULL
Diffstat (limited to 'src')
-rw-r--r--src/hello/address.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/hello/address.c b/src/hello/address.c
index 36f376d5c..0583b273e 100644
--- a/src/hello/address.c
+++ b/src/hello/address.c
@@ -108,6 +108,8 @@ GNUNET_HELLO_address_allocate (const struct GNUNET_PeerIdentity *peer,
struct GNUNET_HELLO_Address *
GNUNET_HELLO_address_copy (const struct GNUNET_HELLO_Address *address)
{
+ if (NULL == address)
+ return NULL;
return GNUNET_HELLO_address_allocate (&address->peer,
address->transport_name,
address->address,
@@ -130,6 +132,13 @@ GNUNET_HELLO_address_cmp (const struct GNUNET_HELLO_Address *a1,
{
int ret;
+ if ( (NULL == a1) &&
+ (NULL == a2) )
+ return 0;
+ if (NULL == a1)
+ return 1;
+ if (NULL == a2)
+ return -1;
ret = strcmp (a1->transport_name, a2->transport_name);
if (0 != ret)
return ret;