diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 73afdc160b..f3fa047e19 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -99,20 +99,18 @@ static bool ListContains(const std::vector& list, static std::string JoinExts(const std::vector& lst) { - if (lst.empty()) { - return ""; - } - std::string result; - std::string separator = ","; - for (std::vector::const_iterator it = lst.begin(); - it != lst.end(); ++it) { - if (it != lst.begin()) { - result += separator; + if (!lst.empty()) { + const std::string separator = ","; + for (std::vector::const_iterator it = lst.begin(); + it != lst.end(); ++it) { + if (it != lst.begin()) { + result += separator; + } + result += '.'; + result += *it; } - result += '.' + (*it); } - result.erase(result.end() - 1); return result; }