diff --git a/Utilities/StrFmt.cpp b/Utilities/StrFmt.cpp index ae150c4f79..c17d374fe5 100644 --- a/Utilities/StrFmt.cpp +++ b/Utilities/StrFmt.cpp @@ -137,14 +137,17 @@ std::vector fmt::split(const std::string& source, std::initializer_ std::string fmt::merge(std::vector source, const std::string& separator) { + if (!source.size()) + return ""; + std::string result; - for (auto &s : source) + for (int i = 0; i < source.size() - 1; ++i) { - result += s + separator; + result += source[i] + separator; } - return result; + return result + source[source.size() - 1]; } std::string fmt::merge(std::initializer_list> sources, const std::string& separator)