1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 06:23:53 +00:00

Avoid underflows if the texture name doesn't include a '.'

This commit is contained in:
Chris Robinson 2013-01-04 15:03:57 -08:00
parent 3f19b13695
commit 1d4d67f811

View file

@ -537,14 +537,11 @@ static Ogre::String getMaterial(const NiTriShape *shape, const Ogre::String &nam
* textures from tga to dds for increased load speed, but all
* texture file name references were kept as .tga.
*/
static const char * path = "textures\\";
static const char path[] = "textures\\";
texName = path + st->filename;
Ogre::String::size_type pos = texName.rfind('.');
if (texName.compare (pos, texName.size () - pos, ".dds") != 0)
if(pos != Ogre::String::npos && texName.compare(pos, texName.length() - pos, ".dds") != 0)
{
// since we know all (GOTY edition or less) textures end
// in .dds, we change the extension