gridview: Add a few assertions

Just to help static analysis out.

self->n_columns can't ever be 0, since
we clamp it between min_columns and
max_columns, with min_columns always
being at least one.
This commit is contained in:
Matthias Clasen 2023-01-13 11:30:13 -05:00
parent 746d12fc43
commit 51b4d70b8f

View File

@ -627,6 +627,8 @@ gtk_grid_view_compute_n_columns (GtkGridView *self,
n_columns = CLAMP (n_columns, self->min_columns, self->max_columns);
g_assert (n_columns > 0);
return n_columns;
}
@ -869,6 +871,8 @@ gtk_grid_view_size_allocate (GtkWidget *widget,
i = 0;
row_height = 0;
g_assert (self->n_columns > 0);
for (cell = gtk_list_item_manager_get_first (self->item_manager);
cell != NULL;
cell = gtk_rb_tree_node_get_next (cell))