> It's an invariant of the 'DirectorySearchResult' class that query is non-null, as the destructor deletes it without checking it for nullity.
Deleting a null pointer is a fully specified no-op in C++.
Deleting a null pointer is a fully specified no-op in C++.
To make the question clearer they should have added a function on the original class that checks (or doesn't check) the pointer before dereferencing it, thereby clarifying whether query being null is valid or not.