From e0cfc0ccf5dead858c0d2c72745fb128eee8a3e6 Mon Sep 17 00:00:00 2001 From: "morozov.andrey" Date: Fri, 26 Oct 2012 19:46:17 +0400 Subject: [PATCH] fixed bug with incorrect syntax in CommandLineParser --- modules/core/src/command_line_parser.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/core/src/command_line_parser.cpp b/modules/core/src/command_line_parser.cpp index dc15356de6..a4ce36be22 100644 --- a/modules/core/src/command_line_parser.cpp +++ b/modules/core/src/command_line_parser.cpp @@ -185,13 +185,21 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const s p.def_value = l[1]; p.help_message = impl->cat_string(l[2]); p.number = -1; - if (p.keys[0][0] == '@') + if (p.keys.size() <= 0) { - p.number = jj; - jj++; + impl->error = true; + impl->error_message = "Field KEYS could not be empty\n"; } + else + { + if (p.keys[0][0] == '@') + { + p.number = jj; + jj++; + } - impl->data.push_back(p); + impl->data.push_back(p); + } } // parse argv