diff --git a/src/Umbraco.Web/Editors/ContentTypeController.cs b/src/Umbraco.Web/Editors/ContentTypeController.cs index 05979c778f..cd8f170ee5 100644 --- a/src/Umbraco.Web/Editors/ContentTypeController.cs +++ b/src/Umbraco.Web/Editors/ContentTypeController.cs @@ -59,7 +59,7 @@ namespace Umbraco.Web.Editors { types = Services.ContentTypeService.GetAllContentTypes().ToList(); - //if no allowed root types are set, just return everythibg + //if no allowed root types are set, just return everything if(types.Any(x => x.AllowedAsRoot)) types = types.Where(x => x.AllowedAsRoot); } @@ -71,9 +71,11 @@ namespace Umbraco.Web.Editors throw new HttpResponseException(HttpStatusCode.NotFound); } - types = Services.ContentTypeService.GetAllContentTypes( - contentItem.ContentType.AllowedContentTypes.Select(x => x.Id.Value).ToArray()) - .ToList(); + var ids = contentItem.ContentType.AllowedContentTypes.Select(x => x.Id.Value).ToArray(); + + if (ids.Any() == false) return Enumerable.Empty(); + + types = Services.ContentTypeService.GetAllContentTypes(ids).ToList(); } var basics = types.Select(Mapper.Map).ToList(); diff --git a/src/Umbraco.Web/Editors/MediaTypeController.cs b/src/Umbraco.Web/Editors/MediaTypeController.cs index 8a3ea55446..8829aca922 100644 --- a/src/Umbraco.Web/Editors/MediaTypeController.cs +++ b/src/Umbraco.Web/Editors/MediaTypeController.cs @@ -61,8 +61,11 @@ namespace Umbraco.Web.Editors throw new HttpResponseException(HttpStatusCode.NotFound); } - return Services.ContentTypeService.GetAllMediaTypes( - contentItem.ContentType.AllowedContentTypes.Select(x => x.Id.Value).ToArray()) + var ids = contentItem.ContentType.AllowedContentTypes.Select(x => x.Id.Value).ToArray(); + + if (ids.Any() == false) return Enumerable.Empty(); + + return Services.ContentTypeService.GetAllMediaTypes(ids) .Select(Mapper.Map); }