Added case for null object and exceptions