[markup] Check for error before warning

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-05-10 10:29:35 +02:00
parent 48482f3712
commit 6a06e44461
1 changed files with 3 additions and 2 deletions

View File

@ -238,8 +238,9 @@ markup_parse(markup_parser_data_t *data, const char *str, ssize_t slen)
|| !g_markup_parse_context_parse(mkp_ctx, "</markup>", -1, &error) || !g_markup_parse_context_parse(mkp_ctx, "</markup>", -1, &error)
|| !g_markup_parse_context_end_parse(mkp_ctx, &error)) || !g_markup_parse_context_end_parse(mkp_ctx, &error))
{ {
warn("unable to parse text \"%s\": %s\n", str, error->message); warn("unable to parse text \"%s\": %s\n", str, error ? error->message : "unknown error");
g_error_free(error); if(error)
g_error_free(error);
g_markup_parse_context_free(mkp_ctx); g_markup_parse_context_free(mkp_ctx);
return false; return false;
} }