fix: crash on --help arg
This commit is contained in:
committed by
Chris Rizzitello
parent
1e3d332002
commit
45f328cd80
@ -187,13 +187,18 @@ void App::initApp(int argc, const char **argv)
|
||||
{
|
||||
|
||||
std::string configFilename;
|
||||
CLI::App cliApp{kAppDescription, kAppName};
|
||||
CLI::App cliApp{kAppDescription};
|
||||
cliApp.add_option("--config-toml", configFilename, "Use TOML configuration file");
|
||||
|
||||
// Allow legacy args.
|
||||
cliApp.allow_extras();
|
||||
|
||||
cliApp.parse(argc, argv);
|
||||
// Having the help argument crashes without try / catch around it
|
||||
try {
|
||||
cliApp.parse(argc, argv);
|
||||
} catch (const CLI::Error &e) {
|
||||
cliApp.exit(e);
|
||||
}
|
||||
|
||||
if (!configFilename.empty()) {
|
||||
Config config(configFilename, configSection());
|
||||
|
||||
Reference in New Issue
Block a user