diff options
| author | Silent <zdanio95@gmail.com> | 2019-07-30 18:43:54 +0200 |
|---|---|---|
| committer | Silent <zdanio95@gmail.com> | 2019-08-01 22:22:05 +0200 |
| commit | 48a4b621255c1aeaeaebd3add616fa6c8738f201 (patch) | |
| tree | 09b5d21dfa7c1c25c2287163c412e142a5c0ca39 /Source/Core/Common/Config/Layer.cpp | |
| parent | cb4eecde529f54ec8c62f9b2137888716c09ba27 (diff) | |
Change Layer code not to create superfluous std::optional entries in LayerMap
Diffstat (limited to 'Source/Core/Common/Config/Layer.cpp')
| -rw-r--r-- | Source/Core/Common/Config/Layer.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/Core/Common/Config/Layer.cpp b/Source/Core/Common/Config/Layer.cpp index 0e201001be..573c79c04e 100644 --- a/Source/Core/Common/Config/Layer.cpp +++ b/Source/Core/Common/Config/Layer.cpp @@ -46,8 +46,14 @@ bool Layer::Exists(const ConfigLocation& location) const bool Layer::DeleteKey(const ConfigLocation& location) { m_is_dirty = true; - bool had_value = m_map[location].has_value(); - m_map[location].reset(); + bool had_value = false; + const auto iter = m_map.find(location); + if (iter != m_map.end() && iter->second.has_value()) + { + iter->second.reset(); + had_value = true; + } + return had_value; } |
