display: Early return in monitor_labeler_show() if no outputs are available

The GVariant constructed here would be useless otherwise, since there are
no outputs to show the labels for. Besides, calling g_variant_builder_close
in this scenario would hit an assertion and the program would crash.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/12
This commit is contained in:
Mario Sanchez Prada 2018-03-12 14:04:05 +00:00 committed by Georges Basile Stavracas Neto
parent 729db87249
commit ca9228bb59

View file

@ -207,13 +207,16 @@ monitor_labeler_show (CcDisplayPanel *self)
if (!priv->shell_proxy || !priv->current_config)
return;
outputs = g_object_get_data (G_OBJECT (priv->current_config), "ui-sorted-outputs");
if (!outputs)
return;
if (cc_display_config_is_cloning (priv->current_config))
return monitor_labeler_hide (self);
g_variant_builder_init (&builder, G_VARIANT_TYPE_TUPLE);
g_variant_builder_open (&builder, G_VARIANT_TYPE_ARRAY);
outputs = g_object_get_data (G_OBJECT (priv->current_config), "ui-sorted-outputs");
for (l = outputs; l != NULL; l = l->next)
{
CcDisplayMonitor *output = l->data;