]> wimlib.net Git - wimlib/blobdiff - src/xml.c
Update wimlib.h documentation
[wimlib] / src / xml.c
index 09f567e368a8933502354847ae8e5016ac3e4519..d6c665575119f2080e50117f3e8685fb9eb6be7b 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -1443,7 +1443,7 @@ WIMLIBAPI bool wimlib_image_name_in_use(const WIMStruct *w, const char *name)
        int i;
 
        DEBUG("Checking to see if the image name `%s' is already in use", name);
        int i;
 
        DEBUG("Checking to see if the image name `%s' is already in use", name);
-       if (!name || !w->wim_info)
+       if (!name || !*name || !w->wim_info)
                return false;
        for (i = 1; i <= w->wim_info->num_images; i++)
                if (strcmp(w->wim_info->images[i - 1].name, name) == 0)
                return false;
        for (i = 1; i <= w->wim_info->num_images; i++)
                if (strcmp(w->wim_info->images[i - 1].name, name) == 0)
@@ -1455,6 +1455,9 @@ WIMLIBAPI bool wimlib_image_name_in_use(const WIMStruct *w, const char *name)
 WIMLIBAPI int wimlib_extract_xml_data(WIMStruct *w, FILE *fp)
 {
        DEBUG("Extracting the XML data.");
 WIMLIBAPI int wimlib_extract_xml_data(WIMStruct *w, FILE *fp)
 {
        DEBUG("Extracting the XML data.");
+       if (!w->xml_data)
+               return WIMLIB_ERR_INVALID_PARAM;
+
        if (fwrite(w->xml_data, 1, w->hdr.xml_res_entry.size, fp) !=
                        w->hdr.xml_res_entry.size) {
                ERROR_WITH_ERRNO("Failed to extract XML data");
        if (fwrite(w->xml_data, 1, w->hdr.xml_res_entry.size, fp) !=
                        w->hdr.xml_res_entry.size) {
                ERROR_WITH_ERRNO("Failed to extract XML data");