[gnome-color-manager] Do not crash the DBus service if a device does not have a profile set and it is included in a query



commit 7793602e1a005ea2d139bb9390ed861d217934db
Author: Richard Hughes <richard hughsie com>
Date:   Tue Mar 23 20:30:45 2010 +0000

    Do not crash the DBus service if a device does not have a profile set and it is included in a query

 src/gcm-dbus.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-dbus.c b/src/gcm-dbus.c
index 8176d18..f9506e9 100644
--- a/src/gcm-dbus.c
+++ b/src/gcm-dbus.c
@@ -194,6 +194,7 @@ gcm_dbus_get_profiles_for_device_internal (GcmDbus *dbus, const gchar *device_id
 	array = g_ptr_array_new_with_free_func ((GDestroyNotify) g_object_unref);
 
 	/* get list */
+	egg_debug ("query=%s [%s] %i", device_id_with_prefix, device_id, use_native_device);
 	array_devices = gcm_client_get_devices (dbus->priv->client);
 	for (i=0; i<array_devices->len; i++) {
 		device = g_ptr_array_index (array_devices, i);
@@ -220,6 +221,12 @@ gcm_dbus_get_profiles_for_device_internal (GcmDbus *dbus, const gchar *device_id
 				      "profile-filename", &filename,
 				      NULL);
 
+			/* we have a profile? */
+			if (filename == NULL) {
+				egg_warning ("%s does not have a profile set", device_id);
+				continue;
+			}
+
 			/* open and parse filename */
 			profile = gcm_profile_default_new ();
 			file = g_file_new_for_path (filename);



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