diff --git a/include/CLI/impl/Option_inl.hpp b/include/CLI/impl/Option_inl.hpp index 96334c3f4..ae78a2630 100644 --- a/include/CLI/impl/Option_inl.hpp +++ b/include/CLI/impl/Option_inl.hpp @@ -664,24 +664,19 @@ CLI11_INLINE int Option::_add_result(std::string &&result, std::vector 1) && !result.empty() && result.front() == '[' && result.back() == ']') { // this is now a vector string likely from the default or user entry - if (result.size() >= 4 && result[1] == '[' && (*(result.end() - 2) == ']')) - { - //this is an escape clause for odd strings - std::string nstrs{ '[' }; - bool duplicated{ true }; - for (int ii = 2; ii < result.size() - 2; ii+=2) - { - if (result[ii] == result[ii + 1]) - { + if(result.size() >= 4 && result[1] == '[' && (*(result.end() - 2) == ']')) { + // this is an escape clause for odd strings + std::string nstrs{'['}; + bool duplicated{true}; + for(int ii = 2; ii < result.size() - 2; ii += 2) { + if(result[ii] == result[ii + 1]) { nstrs.push_back(result[ii]); - } - else { - duplicated=false; + } else { + duplicated = false; break; } } - if (duplicated) - { + if(duplicated) { res.push_back(std::move(nstrs)); ++result_count; return result_count; diff --git a/tests/FuzzFailTest.cpp b/tests/FuzzFailTest.cpp index e4497224f..38db12e6b 100644 --- a/tests/FuzzFailTest.cpp +++ b/tests/FuzzFailTest.cpp @@ -270,7 +270,7 @@ TEST_CASE("app_roundtrip_custom") { int index = GENERATE(range(1, 4)); std::string optionString, flagString; auto parseData = loadFailureFile("round_trip_custom", index); - std::size_t pstring_start{0}; + std::size_t pstring_start{0}; pstring_start = fuzzdata.add_custom_options(app.get(), parseData); if(pstring_start > 0) {