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.
This commit is contained in:
1 parent
84b0973e35
commit
5b1aae12ca
3 files changed
+8
-8
No files matched your search
@@ -15,15 +15,15 @@
|
||||
//! Entry point for BitcoinApplication tests.
|
||||
void OptionTests::optionTests()
|
||||
{
|
||||
// Test regression https://github.com/bitcoin/bitcoin/issues/24457. Check
|
||||
// if setting an integer prune value causes an exception to be thrown in
|
||||
// the OptionsModel constructor.
|
||||
// Test regression https://github.com/bitcoin/bitcoin/issues/24457. Ensure
|
||||
// that setting integer prune value doesn't cause an exception to be thrown
|
||||
// in the OptionsModel constructor
|
||||
gArgs.LockSettings([&](util::Settings& settings) {
|
||||
settings.forced_settings.erase("prune");
|
||||
settings.rw_settings["prune"] = 3814;
|
||||
});
|
||||
gArgs.WriteSettingsFile();
|
||||
QVERIFY_EXCEPTION_THROWN(OptionsModel{}, std::runtime_error);
|
||||
OptionsModel{};
|
||||
gArgs.LockSettings([&](util::Settings& settings) {
|
||||
settings.rw_settings.erase("prune");
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user