demo: Fix drag and drop demo critical

Right now, child is NULL when starting a drag in the main area and
moving the pointer onto the colors, there releasing it.
To avoid gtk_widget_get_ancestor thowing a critical, early exit if child
is NULL.
This commit is contained in:
Florian "sp1rit"​
2024-11-02 19:23:30 +01:00
committed by Matthias Clasen
parent c3e16e68f7
commit 5f0f6f558e

View File

@@ -579,6 +579,8 @@ released_cb (GtkGesture *gesture,
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
child = gtk_widget_pick (widget, x, y, 0);
if (!child)
return;
item = (CanvasItem *)gtk_widget_get_ancestor (child, canvas_item_get_type ());
if (!item)
return;