Avoid creating smart pointer when the node might have been deleted.