summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--progs/util/shaderutil.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/progs/util/shaderutil.c b/progs/util/shaderutil.c
index 745851395a..2f1c4e38b3 100644
--- a/progs/util/shaderutil.c
+++ b/progs/util/shaderutil.c
@@ -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 */