svga: Check if vertex elements has been bound before using it.
authorMichal Krol <michal@vmware.com>
Wed, 10 Mar 2010 11:04:00 +0000 (12:04 +0100)
committerMichal Krol <michal@vmware.com>
Wed, 10 Mar 2010 13:16:40 +0000 (14:16 +0100)
src/gallium/drivers/svga/svga_state_need_swtnl.c

index 10d473584d1241e2e6c20cf4c8e64b905e6afcf6..dfaab53aef44291b8424d31457785ed452314e84 100644 (file)
@@ -76,6 +76,11 @@ static int update_need_swvfetch( struct svga_context *svga,
    unsigned i;
    boolean need_swvfetch = FALSE;
 
+   if (!svga->curr.velems) {
+      /* No vertex elements bound. */
+      return 0;
+   }
+
    for (i = 0; i < svga->curr.velems->count; i++) {
       svga->state.sw.ve_format[i] = svga_translate_vertex_format(svga->curr.velems->velem[i].src_format);
       if (svga->state.sw.ve_format[i] == SVGA3D_DECLTYPE_MAX) {