mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-07 12:54:00 +00:00
Catch possible boost::bad_any_cast exception
This commit is contained in:
parent
0c95ffab8f
commit
fd5e9cf271
@ -102,6 +102,17 @@ bool parseOptions (int argc, char** argv, std::vector<std::string>& files)
|
|||||||
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv).
|
bpo::parsed_options valid_opts = bpo::command_line_parser(argc, argv).
|
||||||
options(desc).positional(p).run();
|
options(desc).positional(p).run();
|
||||||
bpo::store(valid_opts, variables);
|
bpo::store(valid_opts, variables);
|
||||||
|
bpo::notify(variables);
|
||||||
|
if (variables.count ("help"))
|
||||||
|
{
|
||||||
|
std::cout << desc << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (variables.count("input-file"))
|
||||||
|
{
|
||||||
|
files = variables["input-file"].as< std::vector<std::string> >();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(std::exception &e)
|
catch(std::exception &e)
|
||||||
{
|
{
|
||||||
@ -110,18 +121,6 @@ bool parseOptions (int argc, char** argv, std::vector<std::string>& files)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bpo::notify(variables);
|
|
||||||
if (variables.count ("help"))
|
|
||||||
{
|
|
||||||
std::cout << desc << std::endl;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (variables.count("input-file"))
|
|
||||||
{
|
|
||||||
files = variables["input-file"].as< std::vector<std::string> >();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << "No input files or directories specified!" << std::endl;
|
std::cout << "No input files or directories specified!" << std::endl;
|
||||||
std::cout << desc << std::endl;
|
std::cout << desc << std::endl;
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user