[gnome-software] Do not print a critical warning if there is no app description



commit c8377da176baa7b20646f26ce44be2678c23e9f3
Author: Richard Hughes <richard hughsie com>
Date:   Thu Mar 7 19:43:58 2013 +0000

    Do not print a critical warning if there is no app description

 src/gs-app-widget.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/gs-app-widget.c b/src/gs-app-widget.c
index 426e1bd..5fd4256 100644
--- a/src/gs-app-widget.c
+++ b/src/gs-app-widget.c
@@ -186,18 +186,23 @@ gs_app_widget_set_description (GsAppWidget *app_widget, const gchar *description
 {
        gchar **split = NULL;
        GsAppWidgetPrivate *priv = app_widget->priv;
-       GString *description2;
+       GString *description2 = NULL;
        GString *tmp_description_more = NULL;
        GString *tmp_description = NULL;
        guint i;
 
        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);
 
+       /* nothing to set, so use placeholder */
+       if (description == NULL) {
+               priv->description = g_strdup ("No description");
+               priv->description_more = NULL;
+               goto out;
+       }
+
        /* force split with bullet */
        description2 = g_string_new (description);
        _g_string_replace (description2, ". ", "\n* ");
@@ -244,7 +249,8 @@ gs_app_widget_set_description (GsAppWidget *app_widget, const gchar *description
                priv->description_more = NULL;
        }
 out:
-       g_string_free (description2, TRUE);
+       if (description2 != NULL)
+               g_string_free (description2, TRUE);
        if (tmp_description != NULL)
                g_string_free (tmp_description, TRUE);
        if (tmp_description_more != NULL)


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