internal: fix bugs on non-existent dynamic special requests

This commit is contained in:
Vaxry 2024-02-17 19:11:08 +00:00
parent 7b7e7cdd07
commit 65a7f870a6
1 changed files with 7 additions and 1 deletions

View File

@ -263,6 +263,8 @@ CParseResult CConfig::configSetValueSafe(const std::string& command, const std::
valueName += command;
const auto VALUEONLYNAME = valueName.contains(":") ? valueName.substr(valueName.find_last_of(':') + 1) : valueName;
auto VALUEIT = impl->values.find(valueName);
if (VALUEIT == impl->values.end()) {
// it might be in a special category
@ -290,6 +292,10 @@ CParseResult CConfig::configSetValueSafe(const std::string& command, const std::
if (sc->key.empty() || !valueName.starts_with(sc->name))
continue;
// category does exist, check if value exists
if (!sc->defaultValues.contains(VALUEONLYNAME) && VALUEONLYNAME != sc->key)
break;
// bingo
const auto PCAT = impl->specialCategories.emplace_back(std::make_unique<SSpecialCategory>()).get();
PCAT->descriptor = sc.get();