xml_parse_file() fails without assertion warning if xml_open_file() returns NULL.
authorAndrej Kacian <ticho@claws-mail.org>
Mon, 19 Nov 2018 10:23:35 +0000 (11:23 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Tue, 20 Nov 2018 16:22:51 +0000 (17:22 +0100)
This is not a programmer mistake, therefore an assertion
warning is not a good idea. xml_open_file() already shows
an assertion warning if necessary.

src/common/xml.c

index 874db1f94e72ec66789e43a7045115ed362fbfcf..5ed7597f3528650c2b7749a9c6092c6f17c78f73 100644 (file)
@@ -88,6 +88,7 @@ XMLFile *xml_open_file(const gchar *path)
 
        newfile->fp = claws_fopen(path, "rb");
        if (!newfile->fp) {
+               FILE_OP_ERROR(path, "fopen");
                g_free(newfile);
                return NULL;
        }
@@ -161,7 +162,8 @@ GNode *xml_parse_file(const gchar *path)
        GNode *node;
 
        file = xml_open_file(path);
-       cm_return_val_if_fail(file != NULL, NULL);
+       if (file == NULL)
+               return NULL;
 
        xml_get_dtd(file);