From b67eab3b0050a1f08d9c56138969d1a659ee7eac Mon Sep 17 00:00:00 2001 From: Kahrl Date: Tue, 19 Jan 2016 10:15:01 +0100 Subject: [PATCH] Fix Settings::remove() always returning true --- src/settings.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/settings.cpp b/src/settings.cpp index e1e01e81a..8ea687d1c 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -880,8 +880,14 @@ bool Settings::remove(const std::string &name) { MutexAutoLock lock(m_mutex); - delete m_settings[name].group; - return m_settings.erase(name); + std::map::iterator it = m_settings.find(name); + if (it != m_settings.end()) { + delete it->second.group; + m_settings.erase(it); + return true; + } else { + return false; + } } -- 2.25.1