Skip to content

Commit 71cd6c8

Browse files
committed
Prevent NullReferenceException
Prevent NullReferenceException when kernel.GetSingleInstanceActivationError(type) does not return an error.
1 parent d12aca7 commit 71cd6c8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/FluentAssertions.Ioc.Ninject/SingleTypeKernelAssertions.cs

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public void To<T>()
5757

5858
private string BuildFailureMessage(ActivationError error)
5959
{
60+
if (error == null) return string.Empty;
61+
6062
var builder = new StringBuilder();
6163

6264
builder.AppendFormat("Unable to resolve type {0}.", error.Type.FullName);

0 commit comments

Comments
 (0)