[gnome-color-manager] Protect against missing descriptions in the ICC profile parser



commit 03a6bdfe8f05eb5dac0ece81cc484ec48f441031
Author: Richard Hughes <richard hughsie com>
Date:   Tue Nov 10 12:47:52 2009 +0000

    Protect against missing descriptions in the ICC profile parser

 po/POTFILES.in    |    1 +
 src/gcm-profile.c |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d3075ec..8816b3e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -9,6 +9,7 @@ src/gcm-client.c
 src/gcm-inspect.c
 src/gcm-import.c
 src/gcm-prefs.c
+src/gcm-profile.c
 src/gcm-utils.c
 src/gcm-session.c
 
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index a0b462a..6ba5193 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -30,6 +30,7 @@
 #include "config.h"
 
 #include <glib-object.h>
+#include <glib/gi18n.h>
 #include <math.h>
 
 #include "egg-debug.h"
@@ -505,6 +506,7 @@ gcm_profile_parse_data (GcmProfile *profile, const gchar *data, gsize length, GE
 	guint tag_offset;
 	gchar *signature;
 	guint32 profile_type;
+	GcmProfilePrivate *priv = profile->priv;
 
 	g_return_val_if_fail (GCM_IS_PROFILE (profile), FALSE);
 	g_return_val_if_fail (data != NULL, FALSE);
@@ -634,6 +636,17 @@ gcm_profile_parse_data (GcmProfile *profile, const gchar *data, gsize length, GE
 		}
 	}
 
+	/* there's nothing sensible to display */
+	if (priv->description == NULL || priv->description[0] == '\0') {
+		g_free (priv->description);
+		if (priv->filename != NULL) {
+			priv->description = g_path_get_basename (priv->filename);
+		} else {
+			/* TRANSLATORS: this is where the ICC profile has no description */
+			priv->description = _("Missing description");
+		}
+	}
+
 	/* success */
 	ret = TRUE;
 



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