diff options
Diffstat (limited to 'src/wallet/load.cpp')
-rw-r--r-- | src/wallet/load.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/wallet/load.cpp b/src/wallet/load.cpp index 129b5c7c2a..2b5c021cda 100644 --- a/src/wallet/load.cpp +++ b/src/wallet/load.cpp @@ -69,7 +69,7 @@ bool VerifyWallets(WalletContext& context) // Pass write=false because no need to write file and probably // better not to. If unnamed wallet needs to be added next startup // and the setting is empty, this code will just run again. - chain.overwriteRwSetting("wallet", wallets, /*write=*/false); + chain.overwriteRwSetting("wallet", std::move(wallets), interfaces::SettingsAction::SKIP_WRITE); } } @@ -77,6 +77,11 @@ bool VerifyWallets(WalletContext& context) std::set<fs::path> wallet_paths; for (const auto& wallet : chain.getSettingsList("wallet")) { + if (!wallet.isStr()) { + chain.initError(_("Invalid value detected for '-wallet' or '-nowallet'. " + "'-wallet' requires a string value, while '-nowallet' accepts only '1' to disable all wallets")); + return false; + } const auto& wallet_file = wallet.get_str(); const fs::path path = fsbridge::AbsPathJoin(GetWalletDir(), fs::PathFromString(wallet_file)); @@ -110,6 +115,11 @@ bool LoadWallets(WalletContext& context) try { std::set<fs::path> wallet_paths; for (const auto& wallet : chain.getSettingsList("wallet")) { + if (!wallet.isStr()) { + chain.initError(_("Invalid value detected for '-wallet' or '-nowallet'. " + "'-wallet' requires a string value, while '-nowallet' accepts only '1' to disable all wallets")); + return false; + } const auto& name = wallet.get_str(); if (!wallet_paths.insert(fs::PathFromString(name)).second) { continue; |