fixed bug with optional argument

This commit is contained in:
QA Hoang 2021-10-12 14:30:47 -07:00
parent 85a21af67a
commit 847c58d4bc
1 changed files with 3 additions and 1 deletions

View File

@ -1819,7 +1819,9 @@ int parse_args(int argc, char* argv[], mako_args_t* args) {
args->disable_ryw = 1;
break;
case ARG_JSON_REPORT:
if (optarg == NULL) {
if (optarg == NULL || (argv[optind] != NULL && argv[optind][0] == '-')) {
// if --report_json is the last option and no file is specified
// or --report_json is followed by another option
strcpy(args->json_output_path, "mako.json");
} else {
strcpy(args->json_output_path, optarg);