Skip to content

Commit

Permalink
Check null for DeploymentStepFactory before step creation (#12332)
Browse files Browse the repository at this point in the history
* Check null for DeploymentStepFactory before step creation

* Fix the build
  • Loading branch information
hishamco authored Sep 6, 2022
1 parent 07a145c commit 0bb23e7
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ await _authorizationService.AuthorizeAsync(User, OrchardCore.Deployment.CommonPe
return Forbid();
}

var step = (ContentItemDeploymentStep)_factories.FirstOrDefault(x => x.Name == nameof(ContentItemDeploymentStep)).Create();
var stepFactory = _factories.FirstOrDefault(x => x.Name == nameof(ContentItemDeploymentStep));

if (stepFactory == null)
{
return BadRequest();
}

var step = (ContentItemDeploymentStep)stepFactory.Create();

step.ContentItemId = contentItem.ContentItemId;

deploymentPlan.DeploymentSteps.Add(step);
Expand Down

0 comments on commit 0bb23e7

Please sign in to comment.