dont load textures with 0 width/height to prevent alloc 0 sized buffer for tinygl
This commit is contained in:
parent
ee0187135d
commit
0145abf1fb
2 changed files with 7 additions and 2 deletions
|
@ -33,7 +33,8 @@ Material::Material(const char *filename, const char *data, int len, const CMap &
|
|||
_height = READ_LE_UINT32(data + 80 + _numImages * 40);
|
||||
|
||||
if ((_width == 0) || (_height == 0)) {
|
||||
warning("bad texture size (%dx%d) for texture %s\n", _width, _height, filename);
|
||||
warning("skip load texture: bad texture size (%dx%d) for texture %s\n", _width, _height, filename);
|
||||
return;
|
||||
}
|
||||
|
||||
data += 100 + _numImages * 40;
|
||||
|
@ -42,9 +43,13 @@ Material::Material(const char *filename, const char *data, int len, const CMap &
|
|||
}
|
||||
|
||||
void Material::select() const {
|
||||
if ((_width == 0) || (_height == 0))
|
||||
return;
|
||||
g_driver->selectMaterial(this);
|
||||
}
|
||||
|
||||
Material::~Material() {
|
||||
if ((_width == 0) || (_height == 0))
|
||||
return;
|
||||
g_driver->destroyMaterial(this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue