draw: fix NULL pointer passed to pango_parse_markup()

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Katherine McKinley 2009-06-15 11:24:56 +02:00 committed by Julien Danjou
parent bb6c309dfe
commit 9c8efee9bf
1 changed files with 4 additions and 0 deletions

4
draw.c
View File

@ -79,6 +79,7 @@ draw_iso2utf8(const char *iso, size_t len, char **dest, ssize_t *dlen)
{ {
warn("text conversion failed: %s", strerror(errno)); warn("text conversion failed: %s", strerror(errno));
p_delete(dest); p_delete(dest);
return false;
} }
if(dlen) if(dlen)
@ -172,6 +173,9 @@ draw_text_context_init(draw_text_context_t *data, const char *str, ssize_t slen)
{ {
GError *error = NULL; GError *error = NULL;
if(!str)
return false;
if(!pango_parse_markup(str, slen, 0, &data->attr_list, &data->text, NULL, &error)) if(!pango_parse_markup(str, slen, 0, &data->attr_list, &data->text, NULL, &error))
{ {
warn("cannot parse pango markup: %s", error ? error->message : "unknown error"); warn("cannot parse pango markup: %s", error ? error->message : "unknown error");