z_sendmany: Only get ua if decoded is ua variant.

This commit is contained in:
therealyingtong 2022-02-17 19:38:02 +08:00
parent 94ab8e4c77
commit 79c0514919
1 changed files with 5 additions and 1 deletions

View File

@ -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<libzcash::UnifiedAddress> ua = std::get<libzcash::UnifiedAddress>(decoded.value());
std::optional<libzcash::UnifiedAddress> ua = std::nullopt;
if (std::holds_alternative<libzcash::UnifiedAddress>(decoded.value())) {
ua = std::get<libzcash::UnifiedAddress>(decoded.value());
}
recipients.push_back(SendManyRecipient(ua, addr.value(), nAmount, memo));
nTotalOut += nAmount;
}