- if (!g_markup_parse_context_end_parse(xml_context, &error))
- fprintf(stderr, "%s: errors occurred reading file.\n", __FUNCTION__);
+ if (xml_context &&
+ !g_markup_parse_context_end_parse(xml_context, &error))
+ fprintf(stderr, "%s: errors occurred while reading file: %s.\n",
+ __FUNCTION__, error->message);
+ g_clear_error (&error);