summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/texobj.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index fbd498dd935..e5b70701c44 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -116,9 +116,10 @@ _mesa_lookup_texture(struct gl_context *ctx, GLuint id)
struct gl_texture_object *
_mesa_lookup_texture_err(struct gl_context *ctx, GLuint id, const char* func)
{
- struct gl_texture_object *texObj;
+ struct gl_texture_object *texObj = NULL;
- texObj = _mesa_lookup_texture(ctx, id); /* Returns NULL if not found. */
+ if (id > 0)
+ texObj = _mesa_lookup_texture(ctx, id); /* Returns NULL if not found. */
if (!texObj)
_mesa_error(ctx, GL_INVALID_OPERATION, "%s(texture)", func);