From fb6642d6a52d2182f8cea235787dfb0c0e359ee9 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Sat, 31 Oct 2015 17:59:14 +0900 Subject: [PATCH] Print response dict when there is one --- src/test/getdns_query.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/test/getdns_query.c b/src/test/getdns_query.c index 2a0ba506..6c1421a6 100644 --- a/src/test/getdns_query.c +++ b/src/test/getdns_query.c @@ -491,16 +491,17 @@ void callback(getdns_context *context, getdns_callback_type_t callback_type, { char *response_str; - if (callback_type == GETDNS_CALLBACK_COMPLETE) { - /* This is a callback with data */; - if (!quiet && (response_str = json ? - getdns_print_json_dict(response, json == 1) - : getdns_pretty_print_dict(response))) { + /* This is a callback with data */; + if (response && !quiet && (response_str = json ? + getdns_print_json_dict(response, json == 1) + : getdns_pretty_print_dict(response))) { - fprintf(stdout, "ASYNC response:\n%s\n", response_str); - validate_chain(response); - free(response_str); - } + fprintf(stdout, "ASYNC response:\n%s\n", response_str); + validate_chain(response); + free(response_str); + } + + if (callback_type == GETDNS_CALLBACK_COMPLETE) { fprintf(stdout, "Response code was: GOOD. Status was: Callback with ID %llu was successfull.\n", (unsigned long long)trans_id);