]> wimlib.net Git - wimlib/blobdiff - src/extract.c
extract.c: check for empty extraction list
[wimlib] / src / extract.c
index ac50fa8fb87c27e5e8a19eb6c8920515b185d22d..c61dac764dfc612e36872c099100ca0c643af58f 100644 (file)
 #  include "config.h"
 #endif
 
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
 #include "wimlib/apply.h"
 #include "wimlib/assert.h"
 #include "wimlib/dentry.h"
 #include "wimlib/wildcard.h"
 #include "wimlib/wim.h"
 
-#include <errno.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
 #define WIMLIB_EXTRACT_FLAG_FROM_PIPE   0x80000000
 #define WIMLIB_EXTRACT_FLAG_IMAGEMODE   0x40000000
 
@@ -1474,6 +1473,11 @@ extract_trees(WIMStruct *wim, struct wim_dentry **trees, size_t num_trees,
        if (ret)
                goto out_cleanup;
 
+       if (unlikely(list_empty(&dentry_list))) {
+               WARNING("There is nothing to extract!");
+               goto out_cleanup;
+       }
+
        ret = dentry_list_resolve_streams(&dentry_list, ctx);
        if (ret)
                goto out_cleanup;