From e3b27cb70d131f04649517ebcb2f2be3c4157c65 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Fri, 28 Aug 2009 23:50:09 +0200 Subject: [PATCH] Only set error in midori_array_from_file if it is not NULL --- midori/midori-array.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/midori/midori-array.c b/midori/midori-array.c index 93195366..4ea123b2 100644 --- a/midori/midori-array.c +++ b/midori/midori-array.c @@ -246,16 +246,18 @@ midori_array_from_file (KatzeArray* array, if (!g_file_test (filename, G_FILE_TEST_EXISTS)) { /* File doesn't exist */ - *error = g_error_new_literal (G_FILE_ERROR, G_FILE_ERROR_NOENT, - _("File not found.")); + if (error) + *error = g_error_new_literal (G_FILE_ERROR, G_FILE_ERROR_NOENT, + _("File not found.")); return FALSE; } if ((doc = xmlParseFile (filename)) == NULL) { /* No valid xml or broken encoding */ - *error = g_error_new_literal (G_FILE_ERROR, G_FILE_ERROR_FAILED, - _("Malformed document.")); + if (error) + *error = g_error_new_literal (G_FILE_ERROR, G_FILE_ERROR_FAILED, + _("Malformed document.")); return FALSE; } @@ -263,8 +265,9 @@ midori_array_from_file (KatzeArray* array, { /* Parsing failed */ xmlFreeDoc (doc); - *error = g_error_new_literal (G_FILE_ERROR, G_FILE_ERROR_FAILED, - _("Malformed document.")); + if (error) + *error = g_error_new_literal (G_FILE_ERROR, G_FILE_ERROR_FAILED, + _("Malformed document.")); return FALSE; } xmlFreeDoc (doc); -- 2.39.5