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

@@ -11,7 +11,6 @@ using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Serialization;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
using Umbraco.Web.Common.Exceptions;
using Umbraco.Web.Common.Filters;
using Umbraco.Web.Models.ContentEditing;
@@ -71,14 +70,10 @@ namespace Umbraco.Web.BackOffice.Controllers
/// </summary>
protected ILocalizedTextService LocalizedTextService { get; }
protected NotFoundObjectResult HandleContentNotFound(object id, bool throwException = true)
protected NotFoundObjectResult HandleContentNotFound(object id)
{
ModelState.AddModelError("id", $"content with id: {id} was not found");
var errorResponse = NotFound(ModelState);
if (throwException)
{
throw new HttpResponseException(errorResponse);
}
return errorResponse;
}