Fixed possible null reference exceptions
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
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;
|
||||
using Umbraco.Web.Trees;
|
||||
using Umbraco.Web.WebApi;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Trees
|
||||
{
|
||||
@@ -25,7 +24,7 @@ namespace Umbraco.Web.BackOffice.Trees
|
||||
: base(textService, umbracoApiControllerTypeCollection)
|
||||
{
|
||||
}
|
||||
protected override TreeNodeCollection GetTreeNodes(string id, FormCollection queryStrings)
|
||||
protected override ActionResult<TreeNodeCollection> GetTreeNodes(string id, FormCollection queryStrings)
|
||||
{
|
||||
//We don't have any child nodes & only use the root node to load a custom UI
|
||||
return new TreeNodeCollection();
|
||||
@@ -41,9 +40,14 @@ namespace Umbraco.Web.BackOffice.Trees
|
||||
/// Helper method to create a root model for a tree
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
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;
|
||||
|
||||
//this will load in a custom UI instead of the dashboard for the root node
|
||||
root.RoutePath = $"{Constants.Applications.Settings}/{Constants.Trees.Languages}/overview";
|
||||
|
||||
Reference in New Issue
Block a user