Check if the pointer is valid first.