dont load textures with 0 width/height to prevent alloc 0 sized buffer for tinygl

This commit is contained in:
Pawel Kolodziejski 2005-01-13 20:21:12 +00:00
parent ee0187135d
commit 0145abf1fb
2 changed files with 7 additions and 2 deletions

View file

@ -375,7 +375,7 @@ void lua_Restore(SaveRestoreFunc restoreFunc) {
recreateObj(&tempTask->stack.stack[i]);
}
restoreFunc(&tempTask->Cstack.base, sizeof(StkId));
restoreFunc(&tempTask->Cstack.base, sizeof(StkId));
restoreFunc(&tempTask->Cstack.lua2C, sizeof(StkId));
restoreFunc(&tempTask->Cstack.num, sizeof(int));

View file

@ -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);
}