btw. it is safe to call delete on null pointers (it is defined as no operation)