diff --git a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py index 214c39899..bb7e6d20c 100644 --- a/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py +++ b/helpdesk/helpdesk/doctype/hd_ticket/hd_ticket.py @@ -241,11 +241,13 @@ def set_customer(self): # Skip if `Customer` is already set if self.customer: return - customer = get_customer(self.contact) - # let agent assign the customer when one contact has more than one customer - if len(customer) == 1: - self.customer = customer[0] + if self.contact: + customer = get_customer(self.contact) + + # let agent assign the customer when one contact has more than one customer + if len(customer) == 1: + self.customer = customer[0] def set_priority(self): if self.priority: