From 9c3907dab016d9c1477f2bcd1bd64a6452fd3f78 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 17 Jan 2016 19:48:40 -0500 Subject: [PATCH] box gadget: Deal with optional arguments The baseline arguments to the preferred size callback can be NULL. Don't crash if they are. --- gtk/gtkboxgadget.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gtk/gtkboxgadget.c b/gtk/gtkboxgadget.c index e02c8e301c..f62b0d7897 100644 --- a/gtk/gtkboxgadget.c +++ b/gtk/gtkboxgadget.c @@ -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;