From 637f06dcdc2e5b29cbc39445b7141e6a496e1585 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 17 Dec 2008 13:58:05 -0700 Subject: [PATCH] util: check for frag/vertShader=0 before attaching --- progs/util/shaderutil.c | 9 +++++++-- 1 file 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 #include #include #include @@ -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 */ -- 2.30.2