Updated a null pointer check