draw: better GError handling

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-08-18 14:32:05 +02:00
parent 8173bd6ea9
commit 65f5f964ef
1 changed files with 10 additions and 1 deletions

View File

@ -330,7 +330,12 @@ draw_text_markup_expand(draw_parser_data_t *data,
goto bailout; goto bailout;
if(!pango_parse_markup(p.text.s, p.text.len, 0, &data->attr_list, &text, NULL, &error)) if(!pango_parse_markup(p.text.s, p.text.len, 0, &data->attr_list, &text, NULL, &error))
{
warn("cannot parse pango markup: %s", error ? error->message : "unknown error");
if(error)
g_error_free(error);
goto bailout; goto bailout;
}
/* stole text */ /* stole text */
data->text = text; data->text = text;
@ -791,7 +796,11 @@ draw_image_new(const char *filename)
if(filename) if(filename)
{ {
if(!(pixbuf = gdk_pixbuf_new_from_file(filename,&error))) if(!(pixbuf = gdk_pixbuf_new_from_file(filename,&error)))
warn("cannot load image %s: %s", filename, error->message); {
warn("cannot load image %s: %s", filename, error ? error->message : "unknown error");
if(error)
g_error_free(error);
}
else else
{ {
image = p_new(draw_image_t, 1); image = p_new(draw_image_t, 1);