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.
This commit is contained in:
gambas 2020-08-30 21:25:10 +02:00
parent 93f91041e1
commit 183936cfe7

View file

@ -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;