]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
filelists: Don't attempt to cleanup any empty filelists
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 4 Nov 2022 16:35:40 +0000 (16:35 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 4 Nov 2022 16:35:40 +0000 (16:35 +0000)
Walking through the list won't work.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/filelist.c

index 97acff18c05a8c81f98fffa18269e4c81edcd6ab..0a0890d82edf2d9474f3d5bf50356e2a54fc0cf3 100644 (file)
@@ -503,6 +503,10 @@ ERROR:
 int pakfire_filelist_cleanup(struct pakfire_filelist* list) {
        int r;
 
+       // Nothing to do if the filelist is empty
+       if (pakfire_filelist_is_empty(list))
+               return 0;
+
        // Walk through the list backwards
        for (unsigned int i = list->size - 1; i > 0; i--) {
                r = pakfire_file_cleanup(list->elements[i]);