Skip to content

Commit c7baec6

Browse files
committed
fix bad null ref, add test for the future
1 parent 360d469 commit c7baec6

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/StatsN.UnitTests/StastdTests.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ public void EscapeDots()
4949
Assert.Equal("awesome", options.Prefix);
5050
}
5151
[Fact]
52+
public void ConstructWithoutProvider()
53+
{
54+
//check to make sure the constructor doesn't blow
55+
var t = new Statsd(new StatsdOptions()
56+
{
57+
OnExceptionGenerated = (exception) => { throw exception; }
58+
});
59+
t.CountAsync("awesome").GetAwaiter().GetResult();
60+
t.Dispose();
61+
}
62+
[Fact]
5263
public void CorrectMetricTypesPassed()
5364
{
5465
var statsd = Statsd.New<NullChannel>(a => { a.HostOrIp = "localhost"; a.OnExceptionGenerated = (b) => { throw b; }; });

src/StatsN/Statsd.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public Statsd(StatsdOptions options, BaseCommunicationProvider provider = null)
6060
}
6161
if(provider == null)
6262
{
63-
_provider = new Udp();
63+
provider = new Udp();
6464
}
6565
if (string.IsNullOrEmpty(options.HostOrIp))
6666
{

0 commit comments

Comments
 (0)