Merge pull request #8819 from galou/empty_identifier_not_allowed

Do not allow an empty identifier in `getIdentifier`
This commit is contained in:
Chris Hennes
2023-03-15 15:22:42 +00:00
committed by GitHub

View File

@@ -154,6 +154,8 @@ std::string Base::Tools::addNumber(const std::string& name, unsigned int num, in
std::string Base::Tools::getIdentifier(const std::string& name)
{
if (name.empty())
return "_";
// check for first character whether it's a digit
std::string CleanName = name;
if (!CleanName.empty() && CleanName[0] >= 48 && CleanName[0] <= 57)