summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texobj.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/texobj.c')
-rw-r--r--src/mesa/main/texobj.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index d7654eba51a..105ec1eab93 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1780,8 +1780,13 @@ _mesa_BindTextureUnit(GLuint unit, GLuint texture)
struct gl_texture_object *texObj;
struct gl_texture_unit *texUnit;
- /* Get the texture unit (this is an array look-up) */
- texUnit = _mesa_get_tex_unit_err(ctx, unit, "glBindTextureUnit");
+ if (unit >= _mesa_max_tex_unit(ctx)) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glBindTextureUnit(unit=%u)", unit);
+ return;
+ }
+
+ texUnit = _mesa_get_tex_unit(ctx, unit);
+ assert(texUnit);
if (!texUnit) {
return;
}