From 9ef22bed1d44542c729270e4ba49989b680bda46 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 9 Jul 2017 23:06:00 -0400 Subject: [PATCH] Catch some more errors in option parsing flatpak-builder was running into an assertion when --run was used after a non-option. Catch this and exit with a clear error message. Same for --show-deps --- builder/builder-main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/builder/builder-main.c b/builder/builder-main.c index a91ef355..f3414134 100644 --- a/builder/builder-main.c +++ b/builder/builder-main.c @@ -453,6 +453,12 @@ main (int argc, if (is_run && argc == 3) return usage (context, "Program to run must be specified"); + if (opt_show_deps && !is_show_deps) + return usage (context, "Can't use --show-deps after a non-option"); + + if (opt_run && !is_run) + return usage (context, "Can't use --run after a non-option"); + if (is_show_deps) { if (!builder_manifest_show_deps (manifest, build_context, &error))