Avoid potential null pointer dereference