In prepare_target it's plausible that the parameters of
_mesa_lookup_texture might be invalid and NULL is returned,
so we need a NULL pointer check.

CID: 1412566
Signed-off-by: Plamena Manolova <plamena.manol...@intel.com>
---
 src/mesa/main/copyimage.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c
index 2cb617c..dd97f1a 100644
--- a/src/mesa/main/copyimage.c
+++ b/src/mesa/main/copyimage.c
@@ -228,14 +228,17 @@ prepare_target(struct gl_context *ctx, GLuint name, 
GLenum target,
    } else {
       struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name);
 
+      *renderbuffer = NULL;
+
+      if (texObj == NULL)
+        return;
+
       if (target == GL_TEXTURE_CUBE_MAP) {
          *texImage = texObj->Image[z][level];
       }
       else {
          *texImage = _mesa_select_tex_image(texObj, target, level);
       }
-
-      *renderbuffer = NULL;
    }
 }
 
-- 
2.9.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to