Fix 500 error when loading dashboards with slice having deleted dataset (#12535)

diff --git a/superset/models/dashboard.py b/superset/models/dashboard.py
index d3a8363..d7c2a69 100644
--- a/superset/models/dashboard.py
+++ b/superset/models/dashboard.py
@@ -237,6 +237,7 @@
                 # Filter out unneeded fields from the datasource payload
                 datasource.uid: datasource.data_for_slices(slices)
                 for datasource, slices in datasource_slices.items()
+                if datasource
             },
         }