]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bitmap: allow bitmap_iterate() on NULL bitmap
authorDavid Herrmann <dh.herrmann@gmail.com>
Fri, 17 Jul 2015 10:18:13 +0000 (12:18 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Fri, 17 Jul 2015 10:18:13 +0000 (12:18 +0200)
Make sure we properly treat NULL bitmaps as empty. Right now, we don't
(which really looks like a typo).

src/basic/bitmap.c

index d559be1bbbb795eafc6b7b9ca4094fc74cc6197d..83448ca93c6ba74278c1f524e4b4ff33947e4d68 100644 (file)
@@ -152,7 +152,7 @@ bool bitmap_iterate(Bitmap *b, Iterator *i, unsigned *n) {
         long long bitmask;
         unsigned offset, rem;
 
-        if (!b && i->idx == BITMAP_END)
+        if (!b || i->idx == BITMAP_END)
                 return false;
 
         offset = BITMAP_NUM_TO_OFFSET(i->idx);