Compare commits

...

1 Commits

Author SHA1 Message Date
Matthias Clasen
f8efc6f1fa 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
2023-05-17 07:28:45 -04:00

View File

@@ -553,7 +553,8 @@ static int
gtk_grid_view_get_unknown_row_size (GtkGridView *self, gtk_grid_view_get_unknown_row_size (GtkGridView *self,
GArray *heights) 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 */ /* return the median and hope rows are generally uniform with few outliers */
g_array_sort (heights, compare_ints); g_array_sort (heights, compare_ints);