diff options
| author | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-08-03 17:19:32 +0200 |
|---|---|---|
| committer | vaxerski <43317083+vaxerski@users.noreply.github.com> | 2022-08-03 17:19:32 +0200 |
| commit | f488ec166dbf858ba0591f6c968296f09ef342fc (patch) | |
| tree | 4bff0cc80870ec3b98a08f84219cf5e6e2df4e64 | |
| parent | 871c81ac1aa6b61e8af1cbbcf7c04de7b6659248 (diff) | |
fix crash
| -rw-r--r-- | src/config/ConfigManager.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index b8c0ab6e..5ab1d2cd 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -433,7 +433,8 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string return; } - m_dMonitorRules.erase(std::remove_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; })); + if (std::find_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; }) != m_dMonitorRules.end()) + m_dMonitorRules.erase(std::remove_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; })); m_dMonitorRules.push_back(newrule); @@ -468,7 +469,8 @@ void CConfigManager::handleMonitor(const std::string& command, const std::string return; } - m_dMonitorRules.erase(std::remove_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; })); + if (std::find_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; }) != m_dMonitorRules.end()) + m_dMonitorRules.erase(std::remove_if(m_dMonitorRules.begin(), m_dMonitorRules.end(), [&](const auto& other) { return other.name == newrule.name; })); m_dMonitorRules.push_back(newrule); } |
