mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-09 01:40:27 +02:00
Merge bitcoin-core/gui#690: Catch invalid networks combination crash
f4a11d7baf
gui: bugfix, catch invalid networks combination crash (furszy) Pull request description: The app currently crashes if a network is set inside bitcoin.conf and another one is provided as param. The reason is an uncaught runtime_error. ACKs for top commit: jarolrod: tACKf4a11d7baf
johnny9: tACKf4a11d7baf
john-moffett: ACKf4a11d7baf
pablomartin4btc: Tested ACKf4a11d7baf
. hebasto: ACKf4a11d7baf
, tested on Ubuntu 22.04 (Qt 5.15.3). Tree-SHA512: fc5e26ae0a361e37d53d904cc122d07f064f261b309629c6386cb046ab1b3d2c805cbfe0db8ed3e934af52c6cf0ebb0bef9df9117b4330d9b0ea40c76f9270f9
This commit is contained in:
@ -592,14 +592,16 @@ int GuiMain(int argc, char* argv[])
|
|||||||
// Gracefully exit if the user cancels
|
// Gracefully exit if the user cancels
|
||||||
if (!Intro::showIfNeeded(did_show_intro, prune_MiB)) return EXIT_SUCCESS;
|
if (!Intro::showIfNeeded(did_show_intro, prune_MiB)) return EXIT_SUCCESS;
|
||||||
|
|
||||||
/// 6. Determine availability of data directory and parse bitcoin.conf
|
/// 6a. Determine availability of data directory
|
||||||
/// - Do not call gArgs.GetDataDirNet() before this step finishes
|
|
||||||
if (!CheckDataDirOption()) {
|
if (!CheckDataDirOption()) {
|
||||||
InitError(strprintf(Untranslated("Specified data directory \"%s\" does not exist.\n"), gArgs.GetArg("-datadir", "")));
|
InitError(strprintf(Untranslated("Specified data directory \"%s\" does not exist.\n"), gArgs.GetArg("-datadir", "")));
|
||||||
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
||||||
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));
|
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(gArgs.GetArg("-datadir", ""))));
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
/// 6b. Parse bitcoin.conf
|
||||||
|
/// - Do not call gArgs.GetDataDirNet() before this step finishes
|
||||||
if (!gArgs.ReadConfigFiles(error, true)) {
|
if (!gArgs.ReadConfigFiles(error, true)) {
|
||||||
InitError(strprintf(Untranslated("Error reading configuration file: %s\n"), error));
|
InitError(strprintf(Untranslated("Error reading configuration file: %s\n"), error));
|
||||||
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
QMessageBox::critical(nullptr, PACKAGE_NAME,
|
||||||
@ -614,7 +616,6 @@ int GuiMain(int argc, char* argv[])
|
|||||||
// - Needs to be done before createOptionsModel
|
// - Needs to be done before createOptionsModel
|
||||||
|
|
||||||
// Check for chain settings (Params() calls are only valid after this clause)
|
// Check for chain settings (Params() calls are only valid after this clause)
|
||||||
try {
|
|
||||||
SelectParams(gArgs.GetChainName());
|
SelectParams(gArgs.GetChainName());
|
||||||
} catch(std::exception &e) {
|
} catch(std::exception &e) {
|
||||||
InitError(Untranslated(strprintf("%s\n", e.what())));
|
InitError(Untranslated(strprintf("%s\n", e.what())));
|
||||||
|
Reference in New Issue
Block a user