Fix crash of "assimp info" with no parameters

pull/4679/head
Turo Lamminen 2022-08-09 12:39:27 +03:00
parent 56b6446913
commit 219dbbd4af
1 changed files with 6 additions and 6 deletions

View File

@ -286,12 +286,6 @@ void PrintHierarchy(
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
// Implementation of the assimp info utility to print basic file info // Implementation of the assimp info utility to print basic file info
int Assimp_Info(const char *const *params, unsigned int num) { int Assimp_Info(const char *const *params, unsigned int num) {
// --help
if (!strcmp(params[0], "-h") || !strcmp(params[0], "--help") || !strcmp(params[0], "-?")) {
printf("%s", AICMD_MSG_INFO_HELP_E);
return AssimpCmdError::Success;
}
// asssimp info <file> [-r] // asssimp info <file> [-r]
if (num < 1) { if (num < 1) {
printf("assimp info: Invalid number of arguments. " printf("assimp info: Invalid number of arguments. "
@ -299,6 +293,12 @@ int Assimp_Info(const char *const *params, unsigned int num) {
return AssimpCmdError::InvalidNumberOfArguments; return AssimpCmdError::InvalidNumberOfArguments;
} }
// --help
if (!strcmp(params[0], "-h") || !strcmp(params[0], "--help") || !strcmp(params[0], "-?")) {
printf("%s", AICMD_MSG_INFO_HELP_E);
return AssimpCmdError::Success;
}
const std::string in = std::string(params[0]); const std::string in = std::string(params[0]);
// get -r and -v arguments // get -r and -v arguments