aboutsummaryrefslogtreecommitdiff
path: root/src/test/getarg_tests.cpp
diff options
context:
space:
mode:
authorRyan Ofsky <ryan@ofsky.org>2022-03-07 13:29:46 -0500
committerRyan Ofsky <ryan@ofsky.org>2022-03-07 13:29:46 -0500
commit5b1aae12ca4a99c6b09349981a4902717a6a5d3e (patch)
tree98fa7d25f43f6ca80baa9e1d9c69fcfd9295042a /src/test/getarg_tests.cpp
parent84b0973e35dae63cd1b60199b481e24d54e58c97 (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.cpp6
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);