Signed-off-by: Paul Gofman gofmanp@gmail.com --- dlls/d3dx9_36/texture.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c index 12cb2f3983..3f22b050b6 100644 --- a/dlls/d3dx9_36/texture.c +++ b/dlls/d3dx9_36/texture.c @@ -337,12 +337,15 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN else if (h == D3DX_DEFAULT) h = (width ? w : 256);
- assert(!(fmt->block_width & (fmt->block_width - 1))); - assert(!(fmt->block_height & (fmt->block_height - 1))); - if (w & (fmt->block_width - 1)) - w = (w + fmt->block_width) & ~(fmt->block_width - 1); - if (h & (fmt->block_height - 1)) - h = (h + fmt->block_height) & ~(fmt->block_height - 1); + if (fmt) + { + assert(!(fmt->block_width & (fmt->block_width - 1))); + assert(!(fmt->block_height & (fmt->block_height - 1))); + if (w & (fmt->block_width - 1)) + w = (w + fmt->block_width) & ~(fmt->block_width - 1); + if (h & (fmt->block_height - 1)) + h = (h + fmt->block_height) & ~(fmt->block_height - 1); + }
if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(w))) w = make_pow2(w);