aboutsummaryrefslogtreecommitdiffstats
path: root/progs
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-12-17 13:58:05 -0700
committerBrian Paul <[email protected]>2008-12-18 14:17:06 -0700
commit7d41f10605c9e31b8d427f9f63f6505b187ac637 (patch)
tree0cfc4c5886b320a88705ad88de2221fe65d8e72d /progs
parent26b5e92c302e0a83e08aa2100b23c10919a97f4a (diff)
util: check for frag/vertShader=0 before attaching
Diffstat (limited to 'progs')
-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 745851395a7..2f1c4e38b30 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 */