st/mesa: fix a crash due to passing a draw vertex shader into the driver
[mesa.git] / src / mesa / state_tracker / st_atom_constbuf.c
index ffe4b414477eeed5151c93309ba64008e48cdca5..c1682544f497110d95495d32bbf330c0007342b9 100644 (file)
@@ -31,7 +31,7 @@
  *   Brian Paul
  */
 
-#include "main/imports.h"
+#include "util/imports.h"
 #include "program/prog_parameter.h"
 #include "program/prog_print.h"
 #include "main/shaderapi.h"
@@ -212,7 +212,7 @@ st_bind_ubos(struct st_context *st, struct gl_program *prog,
          &st->ctx->UniformBufferBindings[prog->sh.UniformBlocks[i]->Binding];
       st_obj = st_buffer_object(binding->BufferObject);
 
-      cb.buffer = st_obj->buffer;
+      cb.buffer = st_obj ? st_obj->buffer : NULL;
 
       if (cb.buffer) {
          cb.buffer_offset = binding->Offset;