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

View file

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