Skip to content

Commit

Permalink
guard against nulls in PipelineBuilder.Dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
dstockhammer committed Sep 29, 2017
1 parent cd0d0b1 commit ea40ba7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Paramore.Darker/PipelineBuilder.cs
Expand Up @@ -166,11 +166,14 @@ public void Dispose()
{
_logger.DebugFormat("Disposing pipeline; releasing handler and decorators.");

_handlerFactory.Release(_handler);
_handlerFactory?.Release(_handler);

foreach (var decorator in _decorators)
if (_decorators != null && _decorators.Any())
{
_decoratorFactory.Release(decorator);
foreach (var decorator in _decorators)
{
_decoratorFactory.Release(decorator);
}
}
}
}
Expand Down

0 comments on commit ea40ba7

Please sign in to comment.