sizerequest: Avoid a corner case

gcc 11 warns that the code isn't safe when
n_requested_sizes is 0. Add a precondition check
to make it clear that that never happens.
This commit is contained in:
Matthias Clasen 2021-03-17 07:50:24 -04:00
parent ea185cbdda
commit 8b82993dde

View File

@ -698,6 +698,7 @@ gtk_distribute_natural_allocation (int extra_space,
int i;
g_return_val_if_fail (extra_space >= 0, 0);
g_return_val_if_fail (n_requested_sizes > 0, 0);
spreading = g_newa (guint, n_requested_sizes);