diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index 12a985c02d..12d4ce1d76 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -373,9 +373,7 @@ namespace Umbraco.Web /// If an identifier does not match an existing content, it will be missing in the returned value. public IEnumerable Content(params Udi[] ids) { - if (!(ids is IEnumerable udis)) return null; - - return ids.Select(id => ContentQuery.Content(id)); + return ids.Select(id => ContentQuery.Content(id)).WhereNotNull(); } /// @@ -447,10 +445,8 @@ namespace Umbraco.Web /// The existing contents corresponding to the identifiers. /// If an identifier does not match an existing content, it will be missing in the returned value. public IEnumerable Content(IEnumerable ids) - { - if (!(ids is IEnumerable udis)) return null; - - return ids.Select(id => ContentQuery.Content(id)); + { + return ids.Select(id => ContentQuery.Content(id)).WhereNotNull(); } /// @@ -688,9 +684,7 @@ namespace Umbraco.Web /// If an identifier does not match an existing media, it will be missing in the returned value. public IEnumerable Media(params Udi[] ids) { - if (!(ids is IEnumerable udis)) return null; - - return ids.Select(id => ContentQuery.Media(id)); + return ids.Select(id => ContentQuery.Media(id)).WhereNotNull(); } /// @@ -734,9 +728,7 @@ namespace Umbraco.Web /// If an identifier does not match an existing media, it will be missing in the returned value. public IEnumerable Media(IEnumerable ids) { - if (!(ids is IEnumerable udis)) return null; - - return ids.Select(id => ContentQuery.Media(id)); + return ids.Select(id => ContentQuery.Media(id)).WhereNotNull(); } ///