Patch fixed
diff --git a/erpnext/patches/v7_1/save_stock_settings.py b/erpnext/patches/v7_1/save_stock_settings.py
index 83c27dc..d3f0263 100644
--- a/erpnext/patches/v7_1/save_stock_settings.py
+++ b/erpnext/patches/v7_1/save_stock_settings.py
@@ -3,5 +3,13 @@
 
 def execute():
 	stock_settings = frappe.get_doc('Stock Settings')
+	
+	if stock_settings.default_warehouse \
+		and not frappe.db.exists("Warehouse", stock_settings.default_warehouse):
+			stock_settings.default_warehouse = None
+			
+	if stock_settings.stock_uom and not frappe.db.exists("UOM", stock_settings.stock_uom):
+		stock_settings.stock_uom = None
+		
 	stock_settings.flags.ignore_mandatory = True
 	stock_settings.save()