diff options
author | Johannes Schickel | 2011-10-07 00:14:42 +0200 |
---|---|---|
committer | Johannes Schickel | 2011-10-07 00:16:21 +0200 |
commit | 164604805e00d8b17d0725f605575c7ec8741001 (patch) | |
tree | eef96b171add96933422abc95d22fb484abbbc74 /common | |
parent | 7f55737f9cc5b74e5ebf825c7c25fcbe561bccfe (diff) | |
download | scummvm-rg350-164604805e00d8b17d0725f605575c7ec8741001.tar.gz scummvm-rg350-164604805e00d8b17d0725f605575c7ec8741001.tar.bz2 scummvm-rg350-164604805e00d8b17d0725f605575c7ec8741001.zip |
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.
Diffstat (limited to 'common')
-rw-r--r-- | common/config-file.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/common/config-file.cpp b/common/config-file.cpp index 2bdf598ea8..81e0ae6b45 100644 --- a/common/config-file.cpp +++ b/common/config-file.cpp @@ -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: |