diff options
author | Aurèle Oulès <aurele@oules.com> | 2022-12-15 11:02:32 +0100 |
---|---|---|
committer | Aurèle Oulès <aurele@oules.com> | 2023-01-04 13:45:03 +0100 |
commit | 552b51e682b5a52d9e2fbe64e44e623451692bd3 (patch) | |
tree | 793f3f1ba8263479fb63513a91c1234f68f10703 /src/wallet/rpc/util.cpp | |
parent | 67e7ba8e1aea58fc864f9bb1fc0e56b70777185e (diff) |
refactor: Add sanity checks in LabelFromValue
Diffstat (limited to 'src/wallet/rpc/util.cpp')
-rw-r--r-- | src/wallet/rpc/util.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wallet/rpc/util.cpp b/src/wallet/rpc/util.cpp index 26270f23ed..d5f62dbd77 100644 --- a/src/wallet/rpc/util.cpp +++ b/src/wallet/rpc/util.cpp @@ -132,7 +132,10 @@ const LegacyScriptPubKeyMan& EnsureConstLegacyScriptPubKeyMan(const CWallet& wal std::string LabelFromValue(const UniValue& value) { - std::string label = value.get_str(); + static const std::string empty_string; + if (value.isNull()) return empty_string; + + const std::string& label{value.get_str()}; if (label == "*") throw JSONRPCError(RPC_WALLET_INVALID_LABEL_NAME, "Invalid label name"); return label; |