Fri, 25 Jul 2025 18:54:51 +0200
fix broken nullptr handling in asc_shader_use() - fixes #696
src/shader.c | file | annotate | diff | comparison | revisions |
--- a/src/shader.c Fri Jul 25 18:50:36 2025 +0200 +++ b/src/shader.c Fri Jul 25 18:54:51 2025 +0200 @@ -225,10 +225,12 @@ if (asc_shader_invalid(shader)) { asc_active_glctx->active_program = 0; glUseProgram(0); + return -1; + } + if (asc_active_glctx->active_program == shader->gl_id) { + // already using this shader - continue return 0; } - if (asc_active_glctx->active_program == shader->gl_id) return 0; - if (asc_shader_invalid(shader)) return -1; asc_active_glctx->active_program = shader->gl_id; glUseProgram(shader->gl_id); glUniformMatrix4fv(shader->projection, 1, GL_FALSE, camera->projection);