From: Christian Grothoff Date: Fri, 16 Apr 2010 19:34:29 +0000 (+0000) Subject: handle NULL better X-Git-Tag: initial-import-from-subversion-38251~22121 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9fcfa599422b81e875840e5ebeea9dede4281ffa;p=oweals%2Fgnunet.git handle NULL better --- diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c index 88b28a4a8..63e4a02a5 100644 --- a/src/hostlist/hostlist-client.c +++ b/src/hostlist/hostlist-client.c @@ -379,15 +379,14 @@ get_list_url () unsigned int counter; struct Hostlist * pos; - if ( GNUNET_YES == use_preconfigured_list) + if ( (GNUNET_YES == use_preconfigured_list) || + (linked_list_size == 0) ) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using preconfigured bootstrap server\n"); use_preconfigured_list = GNUNET_NO; return get_bootstrap_url(); } - if (linked_list_size == 0) - return NULL; index = GNUNET_CRYPTO_random_u32 ( GNUNET_CRYPTO_QUALITY_WEAK, linked_list_size); counter = 0; pos = linked_list_head; @@ -628,6 +627,9 @@ download_hostlist () CURLcode ret; CURLMcode mret; + current_url = get_list_url (); + if (current_url == NULL) + return; curl = curl_easy_init (); multi = NULL; if (curl == NULL) @@ -636,7 +638,6 @@ download_hostlist () clean_up (); return; } - current_url = get_list_url (); GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, _("Bootstrapping using hostlist at `%s'.\n"), current_url);