From cf0249b4438b8859c97e5c499db1de5615e7e6ae Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 21 Sep 2015 15:33:27 +0200 Subject: fix NPE if denomination key not found --- src/mint/taler-mint-httpd_refresh.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mint/taler-mint-httpd_refresh.c b/src/mint/taler-mint-httpd_refresh.c index b54b2010c..bb1c570fe 100644 --- a/src/mint/taler-mint-httpd_refresh.c +++ b/src/mint/taler-mint-httpd_refresh.c @@ -61,6 +61,7 @@ handle_refresh_melt_binary (struct MHD_Connection *connection, { unsigned int i; struct TMH_KS_StateHandle *key_state; + struct TALER_MINTDB_DenominationKeyIssueInformation *dk; struct TALER_MINTDB_DenominationKeyInformationP *dki; struct TALER_Amount cost; struct TALER_Amount total_cost; @@ -76,9 +77,17 @@ handle_refresh_melt_binary (struct MHD_Connection *connection, key_state = TMH_KS_acquire (); for (i=0;iissue; + dk = TMH_KS_denomination_key_lookup (key_state, + &denom_pubs[i], + TMH_KS_DKU_WITHDRAW); + if (NULL == dk) + { + GNUNET_break_op (0); + TMH_KS_release (key_state); + return TMH_RESPONSE_reply_arg_invalid (connection, + "new_denoms"); + } + dki = &dk->issue; TALER_amount_ntoh (&value, &dki->properties.value); TALER_amount_ntoh (&fee_withdraw, -- cgit v1.2.3