keyboard: Avoid segfault due to no "data" for custom_shortcut_add_row

Ultimately it would be good to get rid of the use of
`g_object_set_data`/`g_object_get_data` here, but this works for now.

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1373.
This commit is contained in:
Ian Douglas Scott 2021-12-01 12:15:45 -08:00 committed by Robert Ancell
parent 7b1af9c8ba
commit fbadba1a18

View file

@ -235,7 +235,7 @@ remove_item (CcKeyboardShortcutDialog *self,
row_data = g_object_get_data (G_OBJECT (child), "data");
if (row_data->item == item)
if (row_data && row_data->item == item)
{
if (strcmp (row_data->section_id, "custom") == 0)
{
@ -411,6 +411,9 @@ reset_shortcut (CcKeyboardShortcutDialog *self,
{
ShortcutRowData *data;
if (row == GTK_WIDGET (self->custom_shortcut_add_row))
return;
data = g_object_get_data (G_OBJECT (row), "data");
/* Don't reset custom shortcuts */