From 183936cfe755e89cf363f3d1c9276410b0d83286 Mon Sep 17 00:00:00 2001 From: gambas Date: Sun, 30 Aug 2020 21:25:10 +0200 Subject: [PATCH] Drawing a null rich text string does not crash anymore. [GB.GTK] * BUG: Drawing a null rich text string does not crash anymore. [GB.GTK3] * BUG: Drawing a null rich text string does not crash anymore. --- gb.gtk/src/gtools.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gb.gtk/src/gtools.cpp b/gb.gtk/src/gtools.cpp index 4e4f54347..9359a628b 100644 --- a/gb.gtk/src/gtools.cpp +++ b/gb.gtk/src/gtools.cpp @@ -947,6 +947,9 @@ char *gt_html_to_pango_string(const char *html, int len_html, bool newline_are_b p_end = &html[len_html < 0 ? strlen(html) : len_html]; p_markup = NULL; + if (len_html == 0) + goto RETURN_STRING; + for (p = html;; p++) { c = *p; @@ -1237,6 +1240,8 @@ char *gt_html_to_pango_string(const char *html, int len_html, bool newline_are_b // This is a workaround for this bug: g_string_prepend_unichar(pango, 0xFEFF); +RETURN_STRING: + p = g_string_free(pango, false); //fprintf(stderr, "pango: '%s'\n", p); return (char *)p;