summaryrefslogtreecommitdiff
path: root/progs/util
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2008-12-17 13:58:05 -0700
committerBrian Paul <brian.paul@tungstengraphics.com>2008-12-17 13:58:05 -0700
commit637f06dcdc2e5b29cbc39445b7141e6a496e1585 (patch)
tree56f2125b9fd978e5030d21c6bb16bfc7c2b5c63f /progs/util
parent3be8d6db9e8bfbd1b3ebf9ac382857ad1e6ef753 (diff)
util: check for frag/vertShader=0 before attaching
Diffstat (limited to 'progs/util')
-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 */