diff --git a/src/page.h b/src/page.h index fe8d1e2..2a63c4b 100644 --- a/src/page.h +++ b/src/page.h @@ -165,10 +165,10 @@ struct tx_details {"pub_key" , tx_pk_str}, {"tx_fee" , fee_str}, {"tx_fee_short" , fee_short_str}, - {"sum_inputs" , fmt::format("{:0.6f}", XMR_AMOUNT(xmr_inputs))}, - {"sum_outputs" , fmt::format("{:0.6f}", XMR_AMOUNT(xmr_outputs))}, - {"sum_inputs_short" , fmt::format("{:0.3f}", XMR_AMOUNT(xmr_inputs))}, - {"sum_outputs_short" , fmt::format("{:0.3f}", XMR_AMOUNT(xmr_outputs))}, + {"sum_inputs" , xmr_amount_to_str(xmr_inputs , "{:0.6f}")}, + {"sum_outputs" , xmr_amount_to_str(xmr_outputs, "{:0.6f}")}, + {"sum_inputs_short" , xmr_amount_to_str(xmr_inputs , "{:0.3f}")}, + {"sum_outputs_short" , xmr_amount_to_str(xmr_outputs, "{:0.3f}")}, {"no_inputs" , static_cast(input_key_imgs.size())}, {"no_outputs" , static_cast(output_pub_keys.size())}, {"mixin" , mixin_str}, diff --git a/src/tools.h b/src/tools.h index 686ccd0..e66e5d8 100644 --- a/src/tools.h +++ b/src/tools.h @@ -253,7 +253,14 @@ static string xmr_amount_to_str(const uint64_t& xmr_amount, string _format="{:0.12f}") { - return fmt::format(_format, XMR_AMOUNT(xmr_amount)); + string amount_str = "?"; + + if (xmr_amount > 0) + { + amount_str = fmt::format(_format, XMR_AMOUNT(xmr_amount)); + } + + return amount_str; } bool