Skip to content

Display and control your Android device

Reorder cli sanity checks

Romain Vimontd31725f07708
diff --git a/app/src/cli.c b/app/src/cli.c
index 7da3b904..791d3c43 100644
--- a/app/src/cli.c
+++ b/app/src/cli.c
@@ -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;