From: Christian Grothoff Date: Tue, 21 Feb 2017 19:11:20 +0000 (+0100) Subject: handle errors without crashing X-Git-Tag: taler-0.2.1~102 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6ffe3aeeacef611c3c34d18fd6b74763ca013b7c;p=oweals%2Fgnunet.git handle errors without crashing --- diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index c6c439e86..2d670c1ee 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c @@ -98,19 +98,22 @@ remove_cont (void *cls, int32_t success, const char *emsg) { + nsqe = NULL; if (GNUNET_YES != success) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - _("Records could not be removed: `%s'\n"), emsg); - if (endbadly_task != NULL) + _("Records could not be removed: `%s'\n"), + emsg); + if (NULL != endbadly_task) GNUNET_SCHEDULER_cancel (endbadly_task); - endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, NULL); + endbadly_task = GNUNET_SCHEDULER_add_now (&endbadly, + NULL); return; } GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Records were removed, perform lookup\n"); removed = GNUNET_YES; - if (endbadly_task != NULL) + if (NULL != endbadly_task) GNUNET_SCHEDULER_cancel (endbadly_task); GNUNET_SCHEDULER_add_now (&end, NULL); } @@ -139,8 +142,11 @@ put_cont (void *cls, int32_t success, "Name store added record for `%s': %s\n", name, (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); - nsqe = GNUNET_NAMESTORE_records_store (nsh, privkey, name, - 0, NULL, &remove_cont, (void *) name); + nsqe = GNUNET_NAMESTORE_records_store (nsh, + privkey, + name, + 0, NULL, + &remove_cont, (void *) name); }