diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-12-21 19:53:15 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-12-26 19:09:10 +0100 |
commit | 0b8086379f0a062582c20471d6cd2646a6d22e93 (patch) | |
tree | f84a16b3700b2dcc7ddf30c784326b4b0837084c /src | |
parent | 7b50eb2efa122200e39646c19a29abab302f7d24 (diff) |
util-lib: make sure more bitmap calls can deal with NULL objects fine
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/bitmap.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/basic/bitmap.c b/src/basic/bitmap.c index 95f59e400a..c8b2427b1c 100644 --- a/src/basic/bitmap.c +++ b/src/basic/bitmap.c @@ -140,7 +140,8 @@ bool bitmap_isset(Bitmap *b, unsigned n) { bool bitmap_isclear(Bitmap *b) { unsigned i; - assert(b); + if (!b) + return true; for (i = 0; i < b->n_bitmaps; i++) if (b->bitmaps[i] != 0) @@ -150,7 +151,9 @@ bool bitmap_isclear(Bitmap *b) { } void bitmap_clear(Bitmap *b) { - assert(b); + + if (!b) + return; b->bitmaps = mfree(b->bitmaps); b->n_bitmaps = 0; |