box gadget: Deal with optional arguments

The baseline arguments to the preferred size callback can
be NULL. Don't crash if they are.
This commit is contained in:
Matthias Clasen 2016-01-17 19:48:40 -05:00
parent 44d94a4aeb
commit 9c3907dab0

View File

@ -238,8 +238,10 @@ gtk_box_gadget_measure_opposite (GtkCssGadget *gadget,
total_min = MAX (total_min, above_min + below_min);
total_nat = MAX (total_nat, above_nat + below_nat);
/* assume GTK_BASELINE_POSITION_CENTER for now */
*minimum_baseline = above_min + (total_min - (above_min + below_min)) / 2;
*natural_baseline = above_nat + (total_nat - (above_nat + below_nat)) / 2;
if (minimum_baseline)
*minimum_baseline = above_min + (total_min - (above_min + below_min)) / 2;
if (natural_baseline)
*natural_baseline = above_nat + (total_nat - (above_nat + below_nat)) / 2;
}
*minimum = total_min;