Fixed possible null reference exceptions

This commit is contained in:
Bjarke Berg
2021-01-14 19:41:32 +01:00
parent 680f8c4d96
commit 04bb4e99b6
32 changed files with 411 additions and 284 deletions

View File

@@ -2,9 +2,9 @@
using System.Linq;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.BackOffice.Filters;
using Umbraco.Web.Common.Attributes;
using Umbraco.Web.Common.Authorization;
using Umbraco.Web.Models.Trees;
@@ -38,9 +38,15 @@ namespace Umbraco.Web.BackOffice.Trees
.Select(dt => CreateTreeNode(dt.Id.ToString(), id, queryStrings, dt.Name, Constants.Icons.MemberGroup, false));
}
protected override TreeNode CreateRootNode(FormCollection queryStrings)
protected override ActionResult<TreeNode> CreateRootNode(FormCollection queryStrings)
{
var root = base.CreateRootNode(queryStrings);
var rootResult = base.CreateRootNode(queryStrings);
if (!(rootResult.Result is null))
{
return rootResult;
}
var root = rootResult.Value;
//check if there are any groups
root.HasChildren = _memberGroupService.GetAll().Any();
return root;