add protection for null pointer (for consistency)