From c038be8ff800e1d486a562c11a993bccf79e0b39 Mon Sep 17 00:00:00 2001 From: wmayer Date: Fri, 30 Dec 2022 16:35:52 +0100 Subject: [PATCH] Base: [skip ci] if array of reserved names is empty then return the suggested name in Base::Tools::getUniqueName --- src/Base/Tools.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Base/Tools.cpp b/src/Base/Tools.cpp index eee272bd9b..0f65a86a0f 100644 --- a/src/Base/Tools.cpp +++ b/src/Base/Tools.cpp @@ -72,6 +72,10 @@ struct string_comp std::string Base::Tools::getUniqueName(const std::string& name, const std::vector& names, int d) { + if (names.empty()) { + return name; + } + // find highest suffix std::string num_suffix; for (std::vector::const_iterator it = names.begin(); it != names.end(); ++it) {