[nautilus] places-sidebar: don't crash when middle clicking on empty space



commit fea4112c35c84bdb124a567c2d84a2f2a8bd172d
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Oct 17 11:18:43 2011 -0400

    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

 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 66e7b70..8488f5e 100644
--- a/src/nautilus-places-sidebar.c
+++ b/src/nautilus-places-sidebar.c
@@ -2890,14 +2890,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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]