gridview: Avoid a critical

The code can hit this path with heights->len
being 0, and it does not seem to have any ill
effects, apart from this critical warning.

Fixes: #5836
This commit is contained in:
Matthias Clasen
2023-05-17 07:27:44 -04:00
parent e79851502c
commit f8efc6f1fa

View File

@@ -553,7 +553,8 @@ static int
gtk_grid_view_get_unknown_row_size (GtkGridView *self,
GArray *heights)
{
g_return_val_if_fail (heights->len > 0, 0);
if (heights->len == 0)
return 0;
/* return the median and hope rows are generally uniform with few outliers */
g_array_sort (heights, compare_ints);