st/mesa: don't draw if the bound element array buffer is not allocated
authorMarek Olšák <marek.olsak@amd.com>
Mon, 19 Mar 2018 20:51:21 +0000 (16:51 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 2 Apr 2018 17:10:36 +0000 (13:10 -0400)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/mesa/state_tracker/st_draw.c

index e9ffc18d915220b9cc4af306296c6d61b542ba5a..8011d0f25ca1c2a9a80252b135992ff83b08a665 100644 (file)
@@ -177,6 +177,13 @@ st_draw_vbo(struct gl_context *ctx,
          /* indices are in a real VBO */
          info.has_user_indices = false;
          info.index.resource = st_buffer_object(bufobj)->buffer;
+
+         /* Return if the bound element array buffer doesn't have any backing
+          * storage. (nothing to do)
+          */
+         if (!info.index.resource)
+            return;
+
          start = pointer_to_offset(ib->ptr) / info.index_size;
       } else {
          /* indices are in user space memory */