Fixing NRE with logging

This commit is contained in:
Murat Girgin 2014-10-07 23:29:23 -07:00
parent fea30a4096
commit d3ef91ea91
2 changed files with 4 additions and 2 deletions

View File

@ -75,7 +75,7 @@ namespace Microsoft.AspNet.Mvc.Logging
private string Formatter(ActionDescriptor descriptor)
{
return descriptor?.DisplayName ?? "No action selected";
return descriptor != null ? descriptor.DisplayName : "No action selected";
}
}
}

View File

@ -57,7 +57,8 @@ namespace Microsoft.AspNet.Mvc
Assert.Empty(values.ActionsMatchingRouteConstraints);
Assert.Empty(values.ActionsMatchingActionConstraints);
Assert.Empty(values.FinalMatches);
Assert.Null(values.SelectedAction);
Assert.Null(values.SelectedAction);
Assert.DoesNotThrow(() => values.Summary);
}
[Fact]
@ -160,6 +161,7 @@ namespace Microsoft.AspNet.Mvc
Assert.Equal<ActionDescriptor>(actions, values.ActionsMatchingActionConstraints);
Assert.Equal<ActionDescriptor>(actions, values.FinalMatches);
Assert.Null(values.SelectedAction);
Assert.DoesNotThrow(() => values.Summary);
}
[Fact]