aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast/s_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/swrast/s_texture.c')
-rw-r--r--mesalib/src/mesa/swrast/s_texture.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c
index 76a31eeae..ffd78a2b8 100644
--- a/mesalib/src/mesa/swrast/s_texture.c
+++ b/mesalib/src/mesa/swrast/s_texture.c
@@ -189,8 +189,15 @@ _swrast_map_teximage(struct gl_context *ctx,
stride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width);
_mesa_get_format_block_size(texImage->TexFormat, &bw, &bh);
- assert(swImage->Buffer);
+ assert(x % bw == 0);
+ assert(y % bh == 0);
+ if (!swImage->Buffer) {
+ /* probably ran out of memory when allocating tex mem */
+ *mapOut = NULL;
+ return;
+ }
+
map = swImage->Buffer;
if (texImage->TexObject->Target == GL_TEXTURE_3D ||