[gnome-color-manager: 2/7] trivial: Ensure we return an error and not crash if there are no profiles for a device or file



commit 183272dd74eaf5fd31872362d16342ff371763e7
Author: Richard Hughes <richard hughsie com>
Date:   Sat Jun 12 08:52:10 2010 +0100

    trivial: Ensure we return an error and not crash if there are no profiles for a device or file

 src/gcm-session.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-session.c b/src/gcm-session.c
index a1402d9..9115ca2 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -340,6 +340,10 @@ gcm_session_get_profiles_for_file (const gchar *filename, GError **error)
 		}
 	}
 
+	/* nothing found, so set error */
+	if (array == NULL)
+		g_set_error_literal (error, 1, 0, "No profiles were found.");
+
 	/* unref list of devices */
 	g_ptr_array_unref (array_devices);
 out:
@@ -400,6 +404,10 @@ gcm_session_get_profiles_for_device (const gchar *device_id_with_prefix, GError
 		}
 	}
 
+	/* nothing found, so set error */
+	if (array == NULL)
+		g_set_error_literal (error, 1, 0, "No profiles were found.");
+
 	/* unref list of devices */
 	g_ptr_array_unref (array_devices);
 	return array;



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