diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-09-21 15:33:27 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-09-21 15:33:27 +0200 |
commit | cf0249b4438b8859c97e5c499db1de5615e7e6ae (patch) | |
tree | e551e8a6d19ed12c809fd8f33b2fd6b4d0677ea5 /src/mint/taler-mint-httpd_refresh.c | |
parent | c60a746a5de7163a1fa8377f3499b6db070dd81a (diff) |
fix NPE if denomination key not found
Diffstat (limited to 'src/mint/taler-mint-httpd_refresh.c')
-rw-r--r-- | src/mint/taler-mint-httpd_refresh.c | 15 |
1 files changed, 12 insertions, 3 deletions
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;i<num_new_denoms;i++) { - dki = &TMH_KS_denomination_key_lookup (key_state, - &denom_pubs[i], - TMH_KS_DKU_WITHDRAW)->issue; + 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, |