GtkPlacesSidebar: Don't crash on dnd

gtk_get_current_event() can return NULL. Don't crash if it does.

https://bugzilla.gnome.org/show_bug.cgi?id=739150
This commit is contained in:
Matthias Clasen 2014-10-25 15:55:54 -04:00
parent e35d91d18f
commit 041ccd7f87

View File

@ -1420,11 +1420,13 @@ static gboolean
clicked_eject_button (GtkPlacesSidebar *sidebar,
GtkTreePath **path)
{
GdkEvent *event = gtk_get_current_event ();
GdkEventButton *button_event = (GdkEventButton *) event;
GdkEvent *event;
if ((event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) &&
over_eject_button (sidebar, button_event->x, button_event->y, path))
event = gtk_get_current_event ();
if (event &&
(event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) &&
over_eject_button (sidebar, ((GdkEventButton *)event)->x, ((GdkEventButton *)event)->y, path))
return TRUE;
return FALSE;