From 79c05149194da386045edaad2f094512ec5bbb7c Mon Sep 17 00:00:00 2001 From: therealyingtong Date: Thu, 17 Feb 2022 19:38:02 +0800 Subject: [PATCH] z_sendmany: Only get ua if decoded is ua variant. --- src/wallet/rpcwallet.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 5673bce0b..4c524cd2f 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -4557,7 +4557,11 @@ UniValue z_sendmany(const UniValue& params, bool fHelp) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, amount must be positive"); } - std::optional ua = std::get(decoded.value()); + std::optional ua = std::nullopt; + if (std::holds_alternative(decoded.value())) { + ua = std::get(decoded.value()); + } + recipients.push_back(SendManyRecipient(ua, addr.value(), nAmount, memo)); nTotalOut += nAmount; }