From 6f9db6c4a16d853bbc5889ad5ff0d9c75e21d69c Mon Sep 17 00:00:00 2001 From: Tomohito Esaki Date: Mon, 1 Apr 2019 17:51:35 +0900 Subject: [PATCH] cairo-util: Don't set title string to Pango layout if the title is NULL If buttons list isn't empty and title is NULL, SEGV is occured in pango_layout_set_text(). This patch fixes this problem. Signed-off-by: Tomohito Esaki --- shared/cairo-util.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/shared/cairo-util.c b/shared/cairo-util.c index d71e0ed4..15cbf82c 100644 --- a/shared/cairo-util.c +++ b/shared/cairo-util.c @@ -463,10 +463,12 @@ create_layout(cairo_t *cr, const char *title) PangoFontDescription *desc; layout = pango_cairo_create_layout(cr); - pango_layout_set_text(layout, title, -1); - desc = pango_font_description_from_string("Sans Bold 10"); - pango_layout_set_font_description(layout, desc); - pango_font_description_free(desc); + if (title) { + pango_layout_set_text(layout, title, -1); + desc = pango_font_description_from_string("Sans Bold 10"); + pango_layout_set_font_description(layout, desc); + pango_font_description_free(desc); + } pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END); pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT); pango_layout_set_auto_dir (layout, FALSE);