mirror of
https://github.com/glest/glest-source.git
synced 2025-09-28 08:29:00 +02:00
- check for empty strings before using substr to avoid crashes with more strict C++ engine
This commit is contained in:
@@ -78,7 +78,7 @@ void StaticSound::load(const string &path) {
|
||||
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) {
|
||||
return;
|
||||
}
|
||||
string ext= path.substr(path.find_last_of('.')+1);
|
||||
string ext = (path.empty() == false ? path.substr(path.find_last_of('.')+1) : "");
|
||||
soundFileLoader= SoundFileLoaderFactory::getInstance()->newInstance(ext);
|
||||
|
||||
if(soundFileLoader == NULL) {
|
||||
@@ -116,7 +116,7 @@ void StrSound::open(const string &path) {
|
||||
return;
|
||||
}
|
||||
|
||||
string ext= path.substr(path.find_last_of('.')+1);
|
||||
string ext = (path.empty() == false ? path.substr(path.find_last_of('.')+1) : "");
|
||||
|
||||
soundFileLoader= SoundFileLoaderFactory::getInstance()->newInstance(ext);
|
||||
soundFileLoader->open(path, &info);
|
||||
|
Reference in New Issue
Block a user