From fc2c3bda5c637b82d00b42e5da948a09b8bd9aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 1 Nov 2015 17:50:44 +0100 Subject: Fix arguments parsing in the main function Fixes #2611 which was a regression from 692216b86ab97db91e7ff3903ffc9ac8e37433f6. The bogus behaviour considered that if there were more than one arguments left to parse, they would be a pair of arguments (switch and its parameter), and thus skipped the next argument in all cases (thus potentially skipping a "-editor", which triggered #2611). This is fixed by checking first for arguments that don't expect a parameter, and only afterwards for arguments that expect a parameter. And if a "pair" of arguments is not valid, we no longer increment the counter. --- main/main.cpp | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index 9cd190a0e8..3ef357e253 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1007,8 +1007,21 @@ bool Main::start() { bool export_debug=false; List args = OS::get_singleton()->get_cmdline_args(); for (int i=0;i