Core/Settings: Fix a crash if worldserver.conf DataDir setting is empty

This commit is contained in:
Nay
2013-08-24 14:29:46 +01:00
parent 0d5181af4d
commit cc3055f344

View File

@@ -1105,7 +1105,7 @@ void World::LoadConfigSettings(bool reload)
///- Read the "Data" directory from the config file
std::string dataPath = sConfigMgr->GetStringDefault("DataDir", "./");
if (dataPath.at(dataPath.length()-1) != '/' && dataPath.at(dataPath.length()-1) != '\\')
if (dataPath.empty() || (dataPath.back() != '/' && dataPath.back() != '\\'))
dataPath.push_back('/');
#if PLATFORM == PLATFORM_UNIX || PLATFORM == PLATFORM_APPLE