summaryrefslogtreecommitdiff
path: root/src/settings.cpp
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2018-09-30 19:57:31 +0200
committerGitHub <noreply@github.com>2018-09-30 19:57:31 +0200
commita29bc8e8babd9320b629e67dee753a08d18799d3 (patch)
treee503c16f83bd954f2541566155980d6af84a156b /src/settings.cpp
parent18a8fbf465b47c4780d63f34c960af7a52d0cf82 (diff)
downloadminetest-a29bc8e8babd9320b629e67dee753a08d18799d3.tar.gz
minetest-a29bc8e8babd9320b629e67dee753a08d18799d3.tar.bz2
minetest-a29bc8e8babd9320b629e67dee753a08d18799d3.zip
Remove settings properly (#7676)
Diffstat (limited to 'src/settings.cpp')
-rw-r--r--src/settings.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/settings.cpp b/src/settings.cpp
index 0c34eb10c..4dd72a4f4 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -225,9 +225,13 @@ bool Settings::updateConfigObject(std::istream &is, std::ostream &os,
case SPE_KVPAIR:
it = m_settings.find(name);
if (it != m_settings.end() &&
- (it->second.is_group || it->second.value != value)) {
+ (it->second.is_group || it->second.value != value)) {
printEntry(os, name, it->second, tab_depth);
was_modified = true;
+ } else if (it == m_settings.end()) {
+ // Remove by skipping
+ was_modified = true;
+ break;
} else {
os << line << "\n";
if (event == SPE_MULTILINE)
@@ -242,6 +246,10 @@ bool Settings::updateConfigObject(std::istream &is, std::ostream &os,
sanity_check(it->second.group != NULL);
was_modified |= it->second.group->updateConfigObject(is, os,
"}", tab_depth + 1);
+ } else if (it == m_settings.end()) {
+ // Remove by skipping
+ was_modified = true;
+ break;
} else {
printEntry(os, name, it->second, tab_depth);
was_modified = true;
@@ -901,6 +909,8 @@ bool Settings::remove(const std::string &name)
if (it != m_settings.end()) {
delete it->second.group;
m_settings.erase(it);
+
+ doCallbacks(name);
return true;
}