summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib
diff options
context:
space:
mode:
author Nathan Woods <npwoods@mess.org>2017-04-02 19:41:40 -0400
committer Nathan Woods <npwoods@mess.org>2017-04-02 19:41:40 -0400
commit44c04cd97adaaf830b2a5db14b05f8dafce3a5ae (patch)
treedeef2837b17ce6b1886aea34a4dfb5629f7b0b36 /src/lib
parente4741f5ac16077f2a7ae8ec0123cd0b296cbd5df (diff)
Fixed issue that could cause bogus arguments to be reported incorrectly
Examples: 'mame -whatever nes' would previously be reported as "Unrecognized argument: nes"
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util/options.cpp11
1 files 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<std::string> &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;
}