In C++ it is fine to call delete on a null pointer so there is no need for the check.