mesa: generate GL_INVALID_OPERATION in _mesa_get_uniform_location() if program isn't linked
diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c
index 3e28d92..182de37 100644
--- a/src/mesa/shader/shader_api.c
+++ b/src/mesa/shader/shader_api.c
@@ -1011,6 +1011,11 @@
    if (!shProg)
       return -1;
 
+   if (shProg->LinkStatus == GL_FALSE) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glGetUniformfv(program)");
+      return -1;
+   }
+
    /* XXX we should return -1 if the uniform was declared, but not
     * actually used.
     */