From 146c8ddbc38d041f2751f414c692285737193415 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Mon, 20 Jun 2016 09:37:43 +0200 Subject: [PATCH] px4_getopt: astyle --- src/platforms/common/px4_getopt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/platforms/common/px4_getopt.c b/src/platforms/common/px4_getopt.c index 6b0427b936..d446a1fadc 100644 --- a/src/platforms/common/px4_getopt.c +++ b/src/platforms/common/px4_getopt.c @@ -168,9 +168,11 @@ __EXPORT int px4_getopt(int argc, char *argv[], const char *options, int *myopti if (takesarg) { *myoptarg = argv[*myoptind]; + if (!*myoptarg) { //Error: option takes an argument, but there is no more argument return -1; } + *myoptind += 1; }