Fix segfault when entered command doesn't exist

This commit is contained in:
X7123M3-256 2017-01-13 23:05:43 +00:00 committed by Ted John
parent 424bb406c3
commit 942ea5be4b
1 changed files with 7 additions and 0 deletions

View File

@ -568,6 +568,12 @@ extern "C"
argEnumerator.TryPop();
const CommandLineCommand * command = CommandLine::FindCommandFor(CommandLine::RootCommands, &argEnumerator);
if (command == nullptr)
{
return EXITCODE_FAIL;
}
if (command->Options != nullptr)
{
auto argEnumeratorForOptions = CommandLineArgEnumerator(argEnumerator);
@ -576,6 +582,7 @@ extern "C"
return EXITCODE_FAIL;
}
}
if (command == CommandLine::RootCommands && command->Func == nullptr)
{
return CommandLine::HandleCommandDefault();