[gnome-color-manager] Fix a crash caused by the last commit where some profiles did not contain some fields



commit cfaf15e0a6cd2fb905008a36ab96c892c1da5aff
Author: Richard Hughes <richard hughsie com>
Date:   Thu Nov 12 09:37:42 2009 +0000

    Fix a crash caused by the last commit where some profiles did not contain some fields

 src/gcm-profile.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index 5b854e9..2a71d40 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -499,6 +499,9 @@ gcm_profile_ensure_printable (gchar *data)
 {
 	guint i;
 	guint idx = 0;
+
+	g_return_if_fail (data != NULL);
+
 	for (i=0; data[i] != '\0'; i++) {
 		if (g_ascii_isalnum (data[i]) ||
 		    g_ascii_ispunct (data[i]) ||
@@ -665,9 +668,12 @@ gcm_profile_parse_data (GcmProfile *profile, const gchar *data, gsize length, GE
 	}
 
 	/* Ensure this is displayable */
-	gcm_profile_ensure_printable (priv->description);
-	gcm_profile_ensure_printable (priv->copyright);
-	gcm_profile_ensure_printable (priv->vendor);
+	if (priv->description != NULL)
+		gcm_profile_ensure_printable (priv->description);
+	if (priv->copyright != NULL)
+		gcm_profile_ensure_printable (priv->copyright);
+	if (priv->vendor != NULL)
+		gcm_profile_ensure_printable (priv->vendor);
 
 	/* success */
 	ret = TRUE;



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