diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2022-03-07 13:29:46 -0500 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2022-03-07 13:29:46 -0500 |
commit | 5b1aae12ca4a99c6b09349981a4902717a6a5d3e (patch) | |
tree | 98fa7d25f43f6ca80baa9e1d9c69fcfd9295042a /src/test/getarg_tests.cpp | |
parent | 84b0973e35dae63cd1b60199b481e24d54e58c97 (diff) |
qt: Avoid crash on startup if int specified in settings.json
Fix GUI startup crash reported by Rspigler in
https://github.com/bitcoin/bitcoin/issues/24457 that happens if
settings.json contains an integer value for any of the configuration
options which GUI settings can currently clash with (-dbcache, -par,
-spendzeroconfchange, -signer, -upnp, -natpmp, -listen, -server, -proxy,
-proxy, -onion, -onion, -lang, and -prune).
Fix is a one-line change in ArgsManager::GetArg.
Diffstat (limited to 'src/test/getarg_tests.cpp')
-rw-r--r-- | src/test/getarg_tests.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/getarg_tests.cpp b/src/test/getarg_tests.cpp index 4dc12ec7d7..c877105fe7 100644 --- a/src/test/getarg_tests.cpp +++ b/src/test/getarg_tests.cpp @@ -98,21 +98,21 @@ BOOST_AUTO_TEST_CASE(setting_args) set_foo(99); BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "99"); - BOOST_CHECK_THROW(args.GetArg("foo", "default"), std::runtime_error); + BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "99"); BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 99); BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error); BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error); set_foo(3.25); BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "3.25"); - BOOST_CHECK_THROW(args.GetArg("foo", "default"), std::runtime_error); + BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "3.25"); BOOST_CHECK_THROW(args.GetIntArg("foo", 100), std::runtime_error); BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error); BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error); set_foo(0); BOOST_CHECK_EQUAL(args.GetSetting("foo").write(), "0"); - BOOST_CHECK_THROW(args.GetArg("foo", "default"), std::runtime_error); + BOOST_CHECK_EQUAL(args.GetArg("foo", "default"), "0"); BOOST_CHECK_EQUAL(args.GetIntArg("foo", 100), 0); BOOST_CHECK_THROW(args.GetBoolArg("foo", true), std::runtime_error); BOOST_CHECK_THROW(args.GetBoolArg("foo", false), std::runtime_error); |