summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
authorKahrl <kahrl@gmx.net>2016-01-19 10:15:01 +0100
committerKahrl <kahrl@gmx.net>2016-01-19 10:15:01 +0100
commitb67eab3b0050a1f08d9c56138969d1a659ee7eac (patch)
tree688f343332baf4fee51da75d3affbd0b71db0192 /src/settings.cpp
parent87291ea44a61614d5bd9efc0657926da3f867b5f (diff)
downloadminetest-b67eab3b0050a1f08d9c56138969d1a659ee7eac.tar.gz
minetest-b67eab3b0050a1f08d9c56138969d1a659ee7eac.tar.bz2
minetest-b67eab3b0050a1f08d9c56138969d1a659ee7eac.zip
Fix Settings::remove() always returning true
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp10
1 files 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<std::string, SettingsEntry>::iterator it = m_settings.find(name);
+ if (it != m_settings.end()) {
+ delete it->second.group;
+ m_settings.erase(it);
+ return true;
+ } else {
+ return false;
+ }
}