Fixed: A strange loading crash with bad textures

This commit is contained in:
kaetemi 2012-07-28 12:40:36 +02:00
parent e029348d9a
commit 1f5e08b20f

View file

@ -868,6 +868,13 @@ bool CDriverD3D::uploadTextureInternal (ITexture& tex, CRect& rect, uint8 destMi
D3DFORMAT destFormat, D3DFORMAT srcFormat) D3DFORMAT destFormat, D3DFORMAT srcFormat)
{ {
H_AUTO_D3D(CDriverD3D_uploadTextureInternal) H_AUTO_D3D(CDriverD3D_uploadTextureInternal)
if (rect.Width == 0 || rect.Height == 0)
{
nlwarning("Rectangle width or height cannot be 0");
return false;
}
// The D3D texture // The D3D texture
CTextureDrvInfosD3D* d3dtext = getTextureD3D(tex); CTextureDrvInfosD3D* d3dtext = getTextureD3D(tex);