Prevent potential null pointer dereference