[nautilus/freedesktop-dbus] fdo-dbus: handle g_file_get_parent() failing



commit c0752563fe6f2a0454069b93c9a29dae11a2e833
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Dec 14 12:19:09 2011 +0100

    fdo-dbus: handle g_file_get_parent() failing
    
    g_file_get_parent() can return NULL if the file is a root element.
    Handle that case gracefully in the code.

 src/nautilus-freedesktop-dbus.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/nautilus-freedesktop-dbus.c b/src/nautilus-freedesktop-dbus.c
index b628a3a..03dc7fe 100644
--- a/src/nautilus-freedesktop-dbus.c
+++ b/src/nautilus-freedesktop-dbus.c
@@ -86,10 +86,14 @@ skeleton_handle_show_items_cb (NautilusFreedesktopFileManager1 *object,
 		file = g_file_new_for_uri (uris[i]);
 		parent = g_file_get_parent (file);
 
-		nautilus_application_open_location (fdb->application, parent, file, startup_id);
+		if (parent != NULL) {
+			nautilus_application_open_location (fdb->application, parent, file, startup_id);
+			g_object_unref (parent);
+		} else {
+			nautilus_application_open_location (fdb->application, file, NULL, startup_id);
+		}
 
 		g_object_unref (file);
-		g_object_unref (parent);
 	}
 
 	nautilus_freedesktop_file_manager1_complete_show_items (object, invocation);



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