summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomohito Esaki <etom@igel.co.jp>2019-04-01 17:51:35 +0900
committerSimon Ser <contact@emersion.fr>2019-06-19 07:44:51 +0000
commit8ba1302951919dda1f1b1ab6234dd038b5f60e04 (patch)
tree78084051de254fe79bf82579cdcfb49a22c170d3
parente9dbb0d437a8ea67ac36393951bc10cefafe2926 (diff)
downloadweston-8ba1302951919dda1f1b1ab6234dd038b5f60e04.tar.gz
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 <etom@igel.co.jp> (cherry picked from commit 6f9db6c4a16d853bbc5889ad5ff0d9c75e21d69c)
-rw-r--r--shared/cairo-util.c10
1 files 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);