lib: check null pointer before taking lock for bitarray

In some function in bitarray.c, we should check the pointer
of bitarry before taking bitarray lock.

In this patch, we move the null-check assert before the use of
the struct to provide better validation than a crash.

Signed-off-by: TaiJu Wu <tjwu1217@gmail.com>
1 file changed