Only set error in midori_array_from_file if it is not NULL
This commit is contained in:
parent
1efc9d4488
commit
e3b27cb70d
1 changed files with 9 additions and 6 deletions
|
@ -246,6 +246,7 @@ midori_array_from_file (KatzeArray* array,
|
|||
if (!g_file_test (filename, G_FILE_TEST_EXISTS))
|
||||
{
|
||||
/* File doesn't exist */
|
||||
if (error)
|
||||
*error = g_error_new_literal (G_FILE_ERROR, G_FILE_ERROR_NOENT,
|
||||
_("File not found."));
|
||||
return FALSE;
|
||||
|
@ -254,6 +255,7 @@ midori_array_from_file (KatzeArray* array,
|
|||
if ((doc = xmlParseFile (filename)) == NULL)
|
||||
{
|
||||
/* No valid xml or broken encoding */
|
||||
if (error)
|
||||
*error = g_error_new_literal (G_FILE_ERROR, G_FILE_ERROR_FAILED,
|
||||
_("Malformed document."));
|
||||
return FALSE;
|
||||
|
@ -263,6 +265,7 @@ midori_array_from_file (KatzeArray* array,
|
|||
{
|
||||
/* Parsing failed */
|
||||
xmlFreeDoc (doc);
|
||||
if (error)
|
||||
*error = g_error_new_literal (G_FILE_ERROR, G_FILE_ERROR_FAILED,
|
||||
_("Malformed document."));
|
||||
return FALSE;
|
||||
|
|
Loading…
Reference in a new issue