[Scummvm-cvs-logs] CVS: residual material.cpp,1.13,1.14

Pawel Kolodziejski aquadran at users.sourceforge.net
Thu Jan 13 12:22:23 CET 2005


Update of /cvsroot/scummvm/residual
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20276/residual

Modified Files:
	material.cpp 
Log Message:
dont load textures with 0 width/height to prevent alloc 0 sized buffer for tinygl

Index: material.cpp
===================================================================
RCS file: /cvsroot/scummvm/residual/material.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- material.cpp	12 Jan 2005 18:06:43 -0000	1.13
+++ material.cpp	13 Jan 2005 20:21:11 -0000	1.14
@@ -33,7 +33,8 @@
 	_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 @@
 }
 
 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);
 }





More information about the Scummvm-git-logs mailing list