guarding against potential null pointers