project milestone patch fix
diff --git a/erpnext/patches/v5_0/update_projects.py b/erpnext/patches/v5_0/update_projects.py
index 967352d..29300e5 100644
--- a/erpnext/patches/v5_0/update_projects.py
+++ b/erpnext/patches/v5_0/update_projects.py
@@ -5,13 +5,14 @@
 	frappe.reload_doctype("Project")
 
 	for m in frappe.get_all("Project Milestone", "*"):
-		frappe.get_doc({
-			"doctype": "Task",
-			"subject": m.milestone,
-			"expected_start_date": m.milestone_date,
-			"status": "Open" if m.status=="Pending" else "Closed",
-			"project": m.parent,
-		}).insert(ignore_permissions=True)
+		if m.milestone and m.milestone_date:
+			frappe.get_doc({
+				"doctype": "Task",
+				"subject": m.milestone,
+				"expected_start_date": m.milestone_date,
+				"status": "Open" if m.status=="Pending" else "Closed",
+				"project": m.parent,
+			}).insert(ignore_permissions=True)
 
 	# remove project milestone
 	frappe.delete_doc("DocType", "Project Milestone")