Browse Source

fix object null exception

pull/19418/head
Salih 2 years ago
parent
commit
868e0624c9
  1. 1
      modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs
  2. 13
      modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs

1
modules/blogging/app/Volo.BloggingTestApp/BloggingTestAppModule.cs

@ -78,6 +78,7 @@ namespace Volo.BloggingTestApp
Configure<BloggingUrlOptions>(options =>
{
options.RoutePrefix = null;
options.SingleBlogMode.Enabled = true;
});
Configure<AbpDbConnectionOptions>(options =>

13
modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs

@ -67,6 +67,12 @@ namespace Volo.Blogging.Pages.Blogs.Posts
{
BlogShortName = _blogOptions.SingleBlogMode.BlogName;
}
Blog = await GetBlogAsync(_blogAppService, _blogOptions, BlogShortName);
if(Blog == null)
{
return NotFound();
}
await GetData();
@ -83,6 +89,12 @@ namespace Volo.Blogging.Pages.Blogs.Posts
});
FocusCommentId = comment.Id;
Blog = await GetBlogAsync(_blogAppService, _blogOptions, BlogShortName);
if(Blog == null)
{
return NotFound();
}
await GetData();
@ -91,7 +103,6 @@ namespace Volo.Blogging.Pages.Blogs.Posts
private async Task GetData()
{
Blog = await _blogAppService.GetByShortNameAsync(BlogShortName);
Post = await _postAppService.GetForReadingAsync(new GetPostInput { BlogId = Blog.Id, Url = PostUrl });
PostsList = Post.Writer != null

Loading…
Cancel
Save