Reorder cli sanity checks
Check unexpected additional arguments before other sanity checks.
This commit is contained in:
parent
b0eb1a55d6
commit
d31725f077
1 changed files with 6 additions and 6 deletions
|
@ -1394,6 +1394,12 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|||
}
|
||||
}
|
||||
|
||||
int index = optind;
|
||||
if (index < argc) {
|
||||
LOGE("Unexpected additional argument: %s", argv[index]);
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_V4L2
|
||||
if (!opts->display && !opts->record_filename && !opts->v4l2_device) {
|
||||
LOGE("-N/--no-display requires either screen recording (-r/--record)"
|
||||
|
@ -1425,12 +1431,6 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],
|
|||
opts->force_adb_forward = true;
|
||||
}
|
||||
|
||||
int index = optind;
|
||||
if (index < argc) {
|
||||
LOGE("Unexpected additional argument: %s", argv[index]);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (opts->record_format && !opts->record_filename) {
|
||||
LOGE("Record format specified without recording");
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue