COMMON: Unbreak ConfigFile::renameSection.
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.
This commit is contained in:
parent
7f55737f9c
commit
164604805e
1 changed files with 9 additions and 4 deletions
|
@ -247,10 +247,15 @@ void ConfigFile::renameSection(const String &oldName, const String &newName) {
|
||||||
assert(isValidName(oldName));
|
assert(isValidName(oldName));
|
||||||
assert(isValidName(newName));
|
assert(isValidName(newName));
|
||||||
|
|
||||||
//Section *os = getSection(oldName);
|
Section *os = getSection(oldName);
|
||||||
Section *ns = getSection(newName);
|
const Section *ns = getSection(newName);
|
||||||
if (ns) {
|
if (os) {
|
||||||
ns->name = newName;
|
// 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
|
// TODO: Check here whether there already is a section with the
|
||||||
// new name. Not sure how to cope with that case, we could:
|
// new name. Not sure how to cope with that case, we could:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue