Don't bother trying to standardize event name if there isn't one
This commit is contained in:
parent
89e0d7e2ae
commit
f7cc1842bb
1 changed files with 14 additions and 12 deletions
|
@ -118,22 +118,24 @@ void event_handlers::add_event_handler(const config& cfg, bool is_menu_item)
|
||||||
// name field. Will be moved into the handler.
|
// name field. Will be moved into the handler.
|
||||||
config event_cfg = cfg;
|
config event_cfg = cfg;
|
||||||
|
|
||||||
// Split the name field...
|
if(!name.empty()) {
|
||||||
std::vector<std::string> standardized_names = utils::split(name);
|
// Split the name field...
|
||||||
|
std::vector<std::string> standardized_names = utils::split(name);
|
||||||
|
|
||||||
// ...and standardize each one individually. This ensures they're all valid for by-name lookup.
|
// ...and standardize each one individually. This ensures they're all valid for by-name lookup.
|
||||||
for(std::string& single_name : standardized_names) {
|
for(std::string& single_name : standardized_names) {
|
||||||
if(!utils::might_contain_variables(single_name)) {
|
if(!utils::might_contain_variables(single_name)) {
|
||||||
single_name = standardize_name(single_name);
|
single_name = standardize_name(single_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(!standardized_names.empty());
|
||||||
|
|
||||||
|
// Write the new name back to the config.
|
||||||
|
name = utils::join(standardized_names);
|
||||||
|
event_cfg["name"] = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(!standardized_names.empty());
|
|
||||||
|
|
||||||
// Write the new name back to the config.
|
|
||||||
name = utils::join(standardized_names);
|
|
||||||
event_cfg["name"] = name;
|
|
||||||
|
|
||||||
// Create a new handler.
|
// Create a new handler.
|
||||||
// Do note active_ holds the main shared_ptr, and the other three containers
|
// Do note active_ holds the main shared_ptr, and the other three containers
|
||||||
// construct weak_ptrs from the shared one.
|
// construct weak_ptrs from the shared one.
|
||||||
|
|
Loading…
Add table
Reference in a new issue