layout manager: add a check if the widget exists

Avoid a crash when calling _gtk_widget_get_first_child
Fixes https://github.com/gtk-rs/gtk4-rs/issues/889
This commit is contained in:
Bilal Elmoussaoui 2022-02-11 11:44:16 +01:00
parent 90bccf4e82
commit 6c02017212

View File

@ -424,6 +424,7 @@ gtk_layout_manager_get_request_mode (GtkLayoutManager *manager)
GtkLayoutManagerClass *klass;
g_return_val_if_fail (GTK_IS_LAYOUT_MANAGER (manager), GTK_SIZE_REQUEST_CONSTANT_SIZE);
g_return_val_if_fail (priv->widget != NULL, GTK_SIZE_REQUEST_CONSTANT_SIZE);
klass = GTK_LAYOUT_MANAGER_GET_CLASS (manager);