glsl2: check for _NumLinkedShaders being 0

Otherwise spring 0.82+.4.0 crashes when starting a game
because prog->_LinkedShaders[0] is NULL.

This also fixes piglit test cases glsl-link-empty-prog-0[12].
This commit is contained in:
Török Edvin 2010-09-04 13:48:24 +03:00 committed by Ian Romanick
parent 3ea3f5e0a5
commit c47b289972
1 changed files with 1 additions and 1 deletions

View File

@ -1476,7 +1476,7 @@ link_shaders(GLcontext *ctx, struct gl_shader_program *prog)
assign_uniform_locations(prog);
if (prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) {
if (prog->_NumLinkedShaders && prog->_LinkedShaders[0]->Type == GL_VERTEX_SHADER) {
/* FINISHME: The value of the max_attribute_index parameter is
* FINISHME: implementation dependent based on the value of
* FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be