[gnome-software] Show something sensible if the markdown parser fails



commit cf92e458147f014ece5aca996464ca6810bae0ad
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jan 19 12:08:40 2016 +0000

    Show something sensible if the markdown parser fails
    
    Resolves: https://bugzilla.gnome.org/show_bug.cgi?id=741999

 src/gs-update-dialog.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index ad9e4da..e325f1d 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -112,13 +112,17 @@ set_updates_description_ui (GsUpdateDialog *dialog, GsApp *app)
                                      gs_app_get_update_version (app));
        }
 
+       /* this is set unconditionally just in case the output of the
+        * markdown->PangoMarkup parser is invalid */
+       gtk_label_set_markup (GTK_LABEL (dialog->label_details),
+                             /* TRANSLATORS: this is where the
+                              * packager did not write a
+                              * description for the update */
+                             _("No update description available."));
+
        /* get the update description */
        update_details = gs_app_get_update_details (app);
-       if (update_details == NULL || update_details[0] == '\0') {
-               /* TRANSLATORS: this is where the packager did not write a
-                * description for the update */
-               update_desc = g_strdup (_("No update description available."));
-       } else {
+       if (update_details != NULL) {
                g_autoptr(GsMarkdown) markdown = NULL;
                markdown = gs_markdown_new (GS_MARKDOWN_OUTPUT_PANGO);
                gs_markdown_set_smart_quoting (markdown, FALSE);


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