From 9ea4936a36f5011695a3996c63cfad6b480b3e49 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 24 Nov 2010 16:29:10 +0800 Subject: st/vega: Fix a crash with empty paths. --- src/gallium/state_trackers/vega/path.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/gallium/state_trackers') diff --git a/src/gallium/state_trackers/vega/path.c b/src/gallium/state_trackers/vega/path.c index 05f8b0d997..31c718e1c9 100644 --- a/src/gallium/state_trackers/vega/path.c +++ b/src/gallium/state_trackers/vega/path.c @@ -312,7 +312,15 @@ static void polygon_array_calculate_bounds( struct polygon_array *polyarray ) unsigned i; assert(polys); - assert(polys->num_elements); + + if (!polys->num_elements) { + polyarray->min_x = 0.0f; + polyarray->min_y = 0.0f; + polyarray->max_x = 0.0f; + polyarray->max_y = 0.0f; + return; + } + polygon_bounding_rect((((struct polygon**)polys->data)[0]), bounds); min_x = bounds[0]; min_y = bounds[1]; @@ -362,7 +370,8 @@ static struct polygon_array * path_get_fill_polygons(struct path *p, struct matr sx = sy = px = py = ox = oy = 0.f; - current = polygon_create(32); + if (p->num_segments) + current = polygon_create(32); for (i = 0; i < p->num_segments; ++i) { VGubyte segment = ((VGubyte*)(p->segments->data))[i]; -- cgit v1.2.3