mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Avoid array underflow (& thus SEGV) when no data points are set (workaround segv in bz 208185)
This commit is contained in:
@@ -301,13 +301,15 @@ gtk_cell_renderer_sparkline_render (GtkCellRenderer *cell,
|
||||
cairo_move_to (cr, cx, cy);
|
||||
}
|
||||
}
|
||||
if (priv->filled) {
|
||||
double baseline_y = cell_area->height + cell_area->y;
|
||||
cairo_line_to (cr, points[data->n_values-1].x, baseline_y);
|
||||
cairo_line_to (cr, 0, baseline_y);
|
||||
cairo_fill (cr);
|
||||
} else {
|
||||
cairo_stroke (cr);
|
||||
if (data->n_values) {
|
||||
if (priv->filled) {
|
||||
double baseline_y = cell_area->height + cell_area->y;
|
||||
cairo_line_to (cr, points[data->n_values-1].x, baseline_y);
|
||||
cairo_line_to (cr, 0, baseline_y);
|
||||
cairo_fill (cr);
|
||||
} else {
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
}
|
||||
/* Stop clipping: */
|
||||
cairo_restore (cr);
|
||||
|
||||
@@ -286,13 +286,15 @@ gtk_sparkline_expose (GtkWidget *widget,
|
||||
cairo_move_to (cr, cx, cy);
|
||||
}
|
||||
}
|
||||
if (priv->filled) {
|
||||
double baseline_y = cell_area->height + cell_area->y;
|
||||
cairo_line_to (cr, cell_area->x + cell_area->width, baseline_y);
|
||||
cairo_line_to (cr, 0, baseline_y);
|
||||
cairo_fill (cr);
|
||||
} else {
|
||||
cairo_stroke (cr);
|
||||
if (data->n_values) {
|
||||
if (priv->filled) {
|
||||
double baseline_y = cell_area->height + cell_area->y;
|
||||
cairo_line_to (cr, cell_area->x + cell_area->width, baseline_y);
|
||||
cairo_line_to (cr, 0, baseline_y);
|
||||
cairo_fill (cr);
|
||||
} else {
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Stop clipping: */
|
||||
|
||||
Reference in New Issue
Block a user