Skip to content

Commit

Permalink
COMMON: Unbreak ConfigFile::renameSection.
Browse files Browse the repository at this point in the history
It will still not work when the new section name is already taken, but at
at least when it is not taken it should work now.
  • Loading branch information
Johannes Schickel committed Oct 6, 2011
1 parent 7f55737 commit 1646048
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions common/config-file.cpp
Expand Up @@ -247,10 +247,15 @@ void ConfigFile::renameSection(const String &oldName, const String &newName) {
assert(isValidName(oldName));
assert(isValidName(newName));

//Section *os = getSection(oldName);
Section *ns = getSection(newName);
if (ns) {
ns->name = newName;
Section *os = getSection(oldName);
const Section *ns = getSection(newName);
if (os) {
// HACK: For now we just print a warning, for more info see the TODO
// below.
if (ns)
warning("ConfigFile::renameSection: Section name \"%s\" already used", newName.c_str());
else
os->name = newName;
}
// TODO: Check here whether there already is a section with the
// new name. Not sure how to cope with that case, we could:
Expand Down

0 comments on commit 1646048

Please sign in to comment.