mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-24 05:42:10 +08:00
Fixing NRE with new BlogPost items
This commit is contained in:
@@ -46,9 +46,11 @@ namespace Orchard.Blogs.Handlers {
|
||||
|
||||
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
|
||||
var blogPost = context.ContentItem.As<BlogPostPart>();
|
||||
|
||||
if (blogPost == null)
|
||||
|
||||
// BlogPart can be null if this is a new Blog Post item.
|
||||
if (blogPost == null || blogPost.BlogPart == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
context.Metadata.CreateRouteValues = new RouteValueDictionary {
|
||||
{"Area", "Orchard.Blogs"},
|
||||
|
||||
Reference in New Issue
Block a user