summaryrefslogtreecommitdiff
path: root/src/common/configuration.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-05-13 19:36:00 +0200
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2010-05-16 23:25:26 +0200
commit6ab99f519b3dd96d5d51a8259f07398542dc9473 (patch)
tree839ee57a550b034db081085a1c00d0ba635b8aab /src/common/configuration.cpp
parente5c7ef4573adcdcafec7523a77724b171456b215 (diff)
downloadmanaserv-6ab99f519b3dd96d5d51a8259f07398542dc9473.tar.gz
manaserv-6ab99f519b3dd96d5d51a8259f07398542dc9473.tar.bz2
manaserv-6ab99f519b3dd96d5d51a8259f07398542dc9473.tar.xz
manaserv-6ab99f519b3dd96d5d51a8259f07398542dc9473.zip
Don't return configuration value by reference
The lifetime of the default value is often not long enough to survive to the next statement, so returning it by reference is dangereous. At the moment there may not be any place that actually tries to use the returned value as a reference, but it's better not to wait on it to happen. This was already fixed on the client after it lead to strange crashes. Reviewed-by: Jared Adams
Diffstat (limited to 'src/common/configuration.cpp')
-rw-r--r--src/common/configuration.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/configuration.cpp b/src/common/configuration.cpp
index 71c1811b..80364b0b 100644
--- a/src/common/configuration.cpp
+++ b/src/common/configuration.cpp
@@ -68,8 +68,8 @@ void Configuration::deinitialize()
{
}
-const std::string &Configuration::getValue(const std::string &key,
- const std::string &deflt)
+std::string Configuration::getValue(const std::string &key,
+ const std::string &deflt)
{
std::map<std::string, std::string>::iterator iter = options.find(key);
if (iter == options.end()) return deflt;