swrast: fix crash in AA line code when there's no texture
authorBrian Paul <brianp@vmware.com>
Fri, 27 Jul 2018 18:59:29 +0000 (12:59 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 28 Jul 2018 03:21:24 +0000 (21:21 -0600)
Fixes a crash running the Piglit polygon-mode-facing test (and
probably others).

Reviewed-by: Neha Bhende <bhenden@vmware.com>
src/mesa/swrast/s_aalinetemp.h

index bebb131a5d1e4a3e3fa27c7d2bf4bb7795d30e84..64767a3a5644d4475f5768b926cfbcad666fa324 100644 (file)
@@ -179,10 +179,12 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1)
          if (attr >= VARYING_SLOT_TEX0 && attr < VARYING_SLOT_VAR0) {
             const GLuint u = attr - VARYING_SLOT_TEX0;
             const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current;
-            const struct gl_texture_image *texImage =
-               _mesa_base_tex_image(obj);
-            line.texWidth[attr]  = (GLfloat) texImage->Width;
-            line.texHeight[attr] = (GLfloat) texImage->Height;
+            if (obj) {
+               const struct gl_texture_image *texImage =
+                  _mesa_base_tex_image(obj);
+               line.texWidth[attr]  = (GLfloat) texImage->Width;
+               line.texHeight[attr] = (GLfloat) texImage->Height;
+            }
          }
       ATTRIB_LOOP_END
    }