diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2011-10-17 11:18:43 -0400 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2011-10-17 11:18:43 -0400 |
commit | aa26a4d70d463e4f4e1a1d7ae0252e51d8f5e4a2 (patch) | |
tree | bbca6ba10588ec8025d834c667bb9f349b702d61 | |
parent | 4e9add9f6ab107343adf5459e9f77cd217a953e9 (diff) | |
download | nautilus-aa26a4d70d463e4f4e1a1d7ae0252e51d8f5e4a2.tar.gz |
places-sidebar: don't crash when middle clicking on empty space
gtk_tree_view_get_path_at_pos() can fail; handle that case instead of
passing an invalid GtkTreePath.
https://bugzilla.gnome.org/show_bug.cgi?id=657366
https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/830185
-rw-r--r-- | src/nautilus-places-sidebar.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nautilus-places-sidebar.c b/src/nautilus-places-sidebar.c index 81aa9ec57..6149d6f0d 100644 --- a/src/nautilus-places-sidebar.c +++ b/src/nautilus-places-sidebar.c @@ -2892,14 +2892,20 @@ bookmarks_button_press_event_cb (GtkWidget *widget, GtkTreeIter iter; GtkTreeView *tree_view; NautilusWindowOpenFlags flags = 0; + gboolean res; tree_view = GTK_TREE_VIEW (widget); g_assert (tree_view == sidebar->tree_view); model = gtk_tree_view_get_model (tree_view); - gtk_tree_view_get_path_at_pos (tree_view, (int) event->x, (int) event->y, - &path, NULL, NULL, NULL); + res = gtk_tree_view_get_path_at_pos (tree_view, (int) event->x, (int) event->y, + &path, NULL, NULL, NULL); + + if (!res) { + return FALSE; + } + gtk_tree_model_get_iter (model, &iter, path); if (g_settings_get_boolean (nautilus_preferences, |