diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 8427a46d75..7599001618 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -282,9 +282,10 @@ namespace Umbraco.Core.Services /// public IContent CreateContentWithIdentity(string name, IContent parent, string contentTypeAlias, int userId = 0) { + if (parent == null) throw new ArgumentNullException("parent"); + var contentType = FindContentTypeByAlias(contentTypeAlias); var content = new Content(name, parent, contentType); - content.Path = string.Concat(parent.Path, ",", content.Id); //NOTE: I really hate the notion of these Creating/Created events - they are so inconsistent, I've only just found // out that in these 'WithIdentity' methods, the Saving/Saved events were not fired, wtf. Anyways, they're added now. diff --git a/src/Umbraco.Core/Services/MediaService.cs b/src/Umbraco.Core/Services/MediaService.cs index f4755f281d..0788044734 100644 --- a/src/Umbraco.Core/Services/MediaService.cs +++ b/src/Umbraco.Core/Services/MediaService.cs @@ -190,9 +190,10 @@ namespace Umbraco.Core.Services /// public IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = 0) { + if (parent == null) throw new ArgumentNullException("parent"); + var mediaType = FindMediaTypeByAlias(mediaTypeAlias); var media = new Models.Media(name, parent, mediaType); - media.Path = string.Concat(parent.Path, ",", media.Id); //NOTE: I really hate the notion of these Creating/Created events - they are so inconsistent, I've only just found // out that in these 'WithIdentity' methods, the Saving/Saved events were not fired, wtf. Anyways, they're added now.