nicely handle error from json_dumps without assert

This commit is contained in:
Christian Grothoff 2017-05-09 13:28:01 +02:00
parent a5fedfeeb8
commit 7a259fb7bd
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -321,10 +321,16 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
ph->url = MAH_path_to_url (exchange, "/payback"); ph->url = MAH_path_to_url (exchange, "/payback");
eh = curl_easy_init (); eh = curl_easy_init ();
GNUNET_assert (NULL != (ph->json_enc = ph->json_enc = json_dumps (payback_obj,
json_dumps (payback_obj, JSON_COMPACT);
JSON_COMPACT)));
json_decref (payback_obj); json_decref (payback_obj);
if (NULL == ph->json_enc)
{
GNUNET_break (0);
GNUNET_free (ph->url);
GNUNET_free (ph);
return NULL;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"URL for payback: `%s'\n", "URL for payback: `%s'\n",
ph->url); ph->url);