aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-03-29 19:15:23 +0000
committerMax Horn2004-03-29 19:15:23 +0000
commitb6d911a6164d488f1d7fd978f132de11f8d150e5 (patch)
tree036a3210566dc5a90c95beb34f159ae02145d9f6
parent443c7cdb2573be44815167dbc80a9af88b554904 (diff)
downloadscummvm-rg350-b6d911a6164d488f1d7fd978f132de11f8d150e5.tar.gz
scummvm-rg350-b6d911a6164d488f1d7fd978f132de11f8d150e5.tar.bz2
scummvm-rg350-b6d911a6164d488f1d7fd978f132de11f8d150e5.zip
Fixed a bad crash that occured when adding a new game target in the launcher
svn-id: r13428
-rw-r--r--common/config-manager.cpp31
-rw-r--r--common/config-manager.h26
2 files changed, 37 insertions, 20 deletions
diff --git a/common/config-manager.cpp b/common/config-manager.cpp
index e19afeced0..cca805ec6b 100644
--- a/common/config-manager.cpp
+++ b/common/config-manager.cpp
@@ -240,9 +240,10 @@ void ConfigManager::writeDomain(FILE *file, const String &name, const Domain &do
const String &value = x->_value;
if (!value.isEmpty()) {
// Write comment (if any)
- comment = domain.getKVComment(x->_key);
- if (!comment.isEmpty())
+ if (domain.hasKVComment(x->_key)) {
+ comment = domain.getKVComment(x->_key);
fprintf(file, "%s", comment.c_str());
+ }
// Write the key/value pair
fprintf(file, "%s=%s\n", x->_key.c_str(), value.c_str());
}
@@ -451,4 +452,30 @@ bool ConfigManager::hasGameDomain(const String &domain) const {
return _gameDomains.contains(domain);
}
+
+#pragma mark -
+
+
+const String &ConfigManager::Domain::get(const String &key) const {
+ Node *node = findNode(_root, key);
+ return node ? node->_value : String::emptyString;
+}
+
+void ConfigManager::Domain::setDomainComment(const String &comment) {
+ _domainComment = comment;
+}
+const String &ConfigManager::Domain::getDomainComment() const {
+ return _domainComment;
+}
+
+void ConfigManager::Domain::setKVComment(const String &key, const String &comment) {
+ _keyValueComments[key] = comment;
+}
+const String &ConfigManager::Domain::getKVComment(const String &key) const {
+ return _keyValueComments[key];
+}
+bool ConfigManager::Domain::hasKVComment(const String &key) const {
+ return _keyValueComments.contains(key);
+}
+
} // End of namespace Common
diff --git a/common/config-manager.h b/common/config-manager.h
index 3a54ccfb64..7f01ad01e9 100644
--- a/common/config-manager.h
+++ b/common/config-manager.h
@@ -54,26 +54,16 @@ public:
private:
StringMap _keyValueComments;
String _domainComment;
+
public:
+ const String &get(const String &key) const;
+
+ void setDomainComment(const String &comment);
+ const String &getDomainComment() const;
- const String &get(const String &key) const {
- Node *node = findNode(_root, key);
- return node ? node->_value : String::emptyString;
- }
-
- void setDomainComment(const String &comment) {
- _domainComment = comment;
- }
- const String &getDomainComment() const {
- return _domainComment;
- }
-
- void setKVComment(const String &key, const String &comment) {
- _keyValueComments[key] = comment;
- }
- const String &getKVComment(const String &key) const {
- return _keyValueComments[key];
- }
+ void setKVComment(const String &key, const String &comment);
+ const String &getKVComment(const String &key) const;
+ bool hasKVComment(const String &key) const;
};
typedef Map<String, Domain, IgnoreCaseComparator> DomainMap;