summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/renderergl2/tr_image_dds.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/renderergl2/tr_image_dds.c b/src/renderergl2/tr_image_dds.c
index 578b3eda..8ad406fd 100644
--- a/src/renderergl2/tr_image_dds.c
+++ b/src/renderergl2/tr_image_dds.c
@@ -292,13 +292,18 @@ void R_LoadDDS ( const char *filename, byte **pic, int *width, int *height, GLen
len -= 4 + sizeof(*ddsHeader);
}
- *width = ddsHeader->width;
- *height = ddsHeader->height;
+ if (width)
+ *width = ddsHeader->width;
+ if (height)
+ *height = ddsHeader->height;
- if (ddsHeader->flags & _DDSFLAGS_MIPMAPCOUNT)
- *numMips = ddsHeader->numMips;
- else
- *numMips = 1;
+ if (numMips)
+ {
+ if (ddsHeader->flags & _DDSFLAGS_MIPMAPCOUNT)
+ *numMips = ddsHeader->numMips;
+ else
+ *numMips = 1;
+ }
// FIXME: handle cube map
//if ((ddsHeader->caps2 & DDSCAPS2_CUBEMAP) == DDSCAPS2_CUBEMAP)