Skip to content

Commit

Permalink
internal: fix bugs on non-existent dynamic special requests
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Feb 17, 2024
1 parent 7b7e7cd commit 65a7f87
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ CParseResult CConfig::configSetValueSafe(const std::string& command, const std::

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()) {
// it might be in a special category
bool found = false;
Expand All @@ -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();
Expand Down

0 comments on commit 65a7f87

Please sign in to comment.