Update sales_order.py
diff --git a/erpnext/selling/doctype/sales_order/sales_order.py b/erpnext/selling/doctype/sales_order/sales_order.py
index 747a3c0..51e6c61 100644
--- a/erpnext/selling/doctype/sales_order/sales_order.py
+++ b/erpnext/selling/doctype/sales_order/sales_order.py
@@ -103,7 +103,7 @@
 	def validate_delivery_date(self):
 		if self.order_type == 'Sales':
 			if not self.delivery_date:
-				self.delivery_date = max([d.delivery_date for d in self.get("items")])
+				self.delivery_date = max([d.delivery_date for d in self.get("items") if d.delivery_date])
 
 			if self.delivery_date:
 				for d in self.get("items"):