aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaanwj <126646+laanwj@users.noreply.github.com>2022-05-25 12:25:12 +0200
committerlaanwj <126646+laanwj@users.noreply.github.com>2022-05-25 12:48:17 +0200
commit04fdd644b43af26dd8dc1dda255db16b4b7bf8e6 (patch)
treefcb3041df022f962f4bfd2635f01ef2c86feebfb
parentcb13ba6d11726b40327d899202050a8cb1d476a1 (diff)
parent344537cf04373d757522e042f29f25a0f9595404 (diff)
downloadbitcoin-04fdd644b43af26dd8dc1dda255db16b4b7bf8e6.tar.xz
Merge bitcoin/bitcoin#25180: [22.x] qt: Avoid crash on startup if int specified in settings.json
344537cf04373d757522e042f29f25a0f9595404 qt: Avoid crash on startup if int specified in settings.json (Ryan Ofsky) Pull request description: Backport of #24498 to 22.x branch This was already backported to the 23.x branch in #24511, but vasild discovered the issue can affect 22.x as well https://github.com/bitcoin/bitcoin/pull/15936#issuecomment-1115992866: > While testing this, 22.x crashes if `settings.json` contains `"prune": 1234` due to #24498 which was fixed in 23.0. So, if this PR is included in 24.x and a user upgrades to 24.x and then downgrades to 22.x his 22.x would crash at startup. It's not very important to backport this to 22.x because I can work around the issue other ways, but I do see 22.x is listed as an active branch https://github.com/bitcoin/bitcoin/branches, so if there is another 22.x release, it would be nice to have this fix and not have a wonky uncaught univalue exception waiting to be hit ACKs for top commit: laanwj: ACK 344537cf04373d757522e042f29f25a0f9595404 Tree-SHA512: 479f7fb4b4b73ec85f28e97af9b21d54245b8ab4d246e50134b37f1726fe3c57cf388fe4973f8ccf1b9efa7663166d1fbeb631758b39d4490b5eab82d0c83d77
-rw-r--r--src/util/system.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 65c16fcd97..f54731bf0c 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -588,7 +588,7 @@ bool ArgsManager::IsArgNegated(const std::string& strArg) const
std::string ArgsManager::GetArg(const std::string& strArg, const std::string& strDefault) const
{
const util::SettingsValue value = GetSetting(strArg);
- return value.isNull() ? strDefault : value.isFalse() ? "0" : value.isTrue() ? "1" : value.get_str();
+ return value.isNull() ? strDefault : value.isFalse() ? "0" : value.isTrue() ? "1" : value.isNum() ? value.getValStr() : value.get_str();
}
int64_t ArgsManager::GetArg(const std::string& strArg, int64_t nDefault) const