[gnome-software] trivial: Zero length strings are as good to us as a chocolate teapot



commit 3eddf6a2c78c73703da98e92f50995658a1c267e
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jan 24 11:41:36 2013 +0000

    trivial: Zero length strings are as good to us as a chocolate teapot

 src/gs-app-widget.c |    1 +
 src/gs-main.c       |    8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-app-widget.c b/src/gs-app-widget.c
index 7d9a682..8d4e794 100644
--- a/src/gs-app-widget.c
+++ b/src/gs-app-widget.c
@@ -216,6 +216,7 @@ gs_app_widget_set_description (GsAppWidget *app_widget, const gchar *description
 
 	g_return_if_fail (GS_IS_APP_WIDGET (app_widget));
 	g_return_if_fail (description != NULL);
+	g_return_if_fail (description[0] != '\0');
 
 	g_free (priv->description);
 	g_free (priv->description_more);
diff --git a/src/gs-main.c b/src/gs-main.c
index 107d392..ab35271 100644
--- a/src/gs-main.c
+++ b/src/gs-main.c
@@ -457,9 +457,9 @@ gs_main_installed_add_package (GsMainPrivate *priv, PkPackage *pkg)
 		      "update-text", &update_text,
 		      "update-changelog", &update_changelog,
 		      NULL);
-	if (update_text != NULL)
+	if (update_text != NULL && update_text[0] != '\0')
 		description = update_text;
-	else if (update_changelog != NULL)
+	else if (update_changelog != NULL && update_changelog[0] != '\0')
 		description = update_changelog;
 	else
 		description = pk_package_get_summary (pkg);
@@ -529,12 +529,12 @@ gs_main_installed_add_desktop_file (GsMainPrivate *priv,
 	g_object_get (pkg,
 		      "update-text", &comment,
 		      NULL);
-	if (comment == NULL) {
+	if (comment == NULL || comment[0] == '\0') {
 		g_object_get (pkg,
 			      "update-changelog", &comment,
 			      NULL);
 	}
-	if (comment == NULL) {
+	if (comment == NULL || comment[0] == '\0') {
 		comment = g_key_file_get_string (key_file,
 						 G_KEY_FILE_DESKTOP_GROUP,
 						 G_KEY_FILE_DESKTOP_KEY_COMMENT,



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