util: check for frag/vertShader=0 before attaching

This commit is contained in:
Brian Paul
2008-12-17 13:58:05 -07:00
parent 3be8d6db9e
commit 637f06dcdc
+7 -2
View File
@@ -6,6 +6,7 @@
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <GL/glut.h>
@@ -106,8 +107,12 @@ LinkShaders(GLuint vertShader, GLuint fragShader)
{
GLuint program = glCreateProgram_func();
glAttachShader_func(program, fragShader);
glAttachShader_func(program, vertShader);
assert(vertShader || fragShader);
if (fragShader)
glAttachShader_func(program, fragShader);
if (vertShader)
glAttachShader_func(program, vertShader);
glLinkProgram_func(program);
/* check link */