From: Brian Paul Date: Tue, 16 Sep 2008 19:23:01 +0000 (-0600) Subject: mesa: fix display list regression (check if save->prim_count > 0 in vbo_save_EndList()) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=39cb5b9f73318a069e2d8553243ae17955a85695;p=mesa.git mesa: fix display list regression (check if save->prim_count > 0 in vbo_save_EndList()) --- diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index f93ef3a02a0..f69a33d8176 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1049,12 +1049,14 @@ void vbo_save_EndList( GLcontext *ctx ) /* EndList called inside a (saved) Begin/End pair? */ if (ctx->Driver.CurrentSavePrimitive != PRIM_OUTSIDE_BEGIN_END) { - GLint i = save->prim_count - 1; - ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; - save->prim[i].end = 0; - save->prim[i].count = (save->vert_count - - save->prim[i].start); + if (save->prim_count > 0) { + GLint i = save->prim_count - 1; + ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; + save->prim[i].end = 0; + save->prim[i].count = (save->vert_count - + save->prim[i].start); + } /* Make sure this vertex list gets replayed by the "loopback" * mechanism: