From 44c04cd97adaaf830b2a5db14b05f8dafce3a5ae Mon Sep 17 00:00:00 2001 From: Nathan Woods Date: Sun, 2 Apr 2017 19:41:40 -0400 Subject: Fixed issue that could cause bogus arguments to be reported incorrectly Examples: 'mame -whatever nes' would previously be reported as "Unrecognized argument: nes" --- src/lib/util/options.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/lib/util/options.cpp b/src/lib/util/options.cpp index 3c30c6dfd97..af83291f83b 100644 --- a/src/lib/util/options.cpp +++ b/src/lib/util/options.cpp @@ -361,13 +361,18 @@ bool core_options::parse_command_line(std::vector &args, int priori { // we need to relocate this option if (new_argc != arg) - args[new_argc++] = std::move(args[arg]); + args[new_argc] = std::move(args[arg]); + new_argc++; if (!is_unadorned) { arg++; - if (new_argc != arg && arg < args.size()) - args[new_argc++] = std::move(args[arg]); + if (arg < args.size()) + { + if (new_argc != arg) + args[new_argc] = std::move(args[arg]); + new_argc++; + } } continue; } -- cgit v1.2.3