summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorSamuel Pitoiset <[email protected]>2017-03-01 22:54:09 +0100
committerSamuel Pitoiset <[email protected]>2017-03-06 18:01:38 +0100
commit5ae54c0cf7acfb792d2ca9b22cd5fb5ba811d32c (patch)
tree2974006027539e22dd1792c0d3c3f4126f5392f7 /src/mesa/main
parent5ac6ab701f05ed7e5b9e8c277ca8eba085a98315 (diff)
getteximage: avoid to lookup textures with id 0
This fixes the following assertion when the key is 0. main/hash.c:181: _mesa_HashLookup_unlocked: Assertion `key' failed. Fixes: 633c959fae ("getteximage: Return correct error value when texure object is not found") Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texgetimage.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index c0c50b0518b..37fda3dc9c4 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -1458,7 +1458,9 @@ _mesa_GetTextureSubImage(GLuint texture, GLint level,
{
GET_CURRENT_CONTEXT(ctx);
static const char *caller = "glGetTextureSubImage";
- struct gl_texture_object *texObj =
+ struct gl_texture_object *texObj = NULL;
+
+ if (texture > 0)
_mesa_lookup_texture(ctx, texture);
if (!texObj) {
@@ -1774,9 +1776,11 @@ _mesa_GetCompressedTextureSubImage(GLuint texture, GLint level,
{
GET_CURRENT_CONTEXT(ctx);
static const char *caller = "glGetCompressedTextureImage";
- struct gl_texture_object *texObj;
+ struct gl_texture_object *texObj = NULL;
+
+ if (texture > 0)
+ texObj = _mesa_lookup_texture(ctx, texture);
- texObj = _mesa_lookup_texture(ctx, texture);
if (!texObj) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(texture)", caller);
return;