[gnome-color-manager] trivial: only add EDID_ properties to the generated profile if the data is valid



commit 71c03da65c6658cb210c8111a0003e3ba49eed04
Author: Richard Hughes <richard hughsie com>
Date:   Wed Apr 20 04:44:40 2011 +0100

    trivial: only add EDID_ properties to the generated profile if the data is valid

 src/gcm-session.c |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/src/gcm-session.c b/src/gcm-session.c
index f1883de..f4a4c50 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -428,18 +428,30 @@ gcm_apply_create_icc_profile_for_edid (GcmSessionPrivate *priv,
 	gcm_profile_set_data (profile,
 			      "EDID_md5",
 			      gcm_edid_get_checksum (edid));
-	gcm_profile_set_data (profile,
-			      "EDID_model",
-			      gcm_edid_get_monitor_name (edid));
-	gcm_profile_set_data (profile,
-			      "EDID_serial",
-			      gcm_edid_get_serial_number (edid));
-	gcm_profile_set_data (profile,
-			      "EDID_mnft",
-			      gcm_edid_get_pnp_id (edid));
-	gcm_profile_set_data (profile,
-			      "EDID_manufacturer",
-			      gcm_edid_get_vendor_name (edid));
+	data = gcm_edid_get_monitor_name (edid);
+	if (data != NULL) {
+		gcm_profile_set_data (profile,
+				      "EDID_model",
+				      data);
+	}
+	data = gcm_edid_get_serial_number (edid);
+	if (data != NULL) {
+		gcm_profile_set_data (profile,
+				      "EDID_serial",
+				      data);
+	}
+	data = gcm_edid_get_pnp_id (edid);
+	if (data != NULL) {
+		gcm_profile_set_data (profile,
+				      "EDID_mnft",
+				      data);
+	}
+	data = gcm_edid_get_vendor_name (edid);
+	if (data != NULL) {
+		gcm_profile_set_data (profile,
+				      "EDID_manufacturer",
+				      data);
+	}
 
 	/* save this */
 	ret = gcm_profile_save (profile, filename, error);



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