Skip to content

Commit

Permalink
Fix human-error NullReferenceException in CoapClockStream
Browse files Browse the repository at this point in the history
  • Loading branch information
NZSmartie committed Jan 1, 2018
1 parent a1aea35 commit dedc10a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/CoAPNet/CoapBlockStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ public CoapBlockStream(CoapClient client, CoapMessage baseMessage, ICoapEndpoint
_client = client ?? throw new ArgumentNullException(nameof(client));
_endpoint = endpoint;

if (!_baseMessage.Code.IsRequest())
throw new InvalidOperationException($"Can not create a {nameof(CoapBlockStream)} with a {nameof(baseMessage)}.{nameof(baseMessage.Type)} of {baseMessage.Type}");

_baseMessage = baseMessage?.Clone()
?? throw new ArgumentNullException(nameof(baseMessage));

if (!_baseMessage.Code.IsRequest())
throw new InvalidOperationException($"Can not create a {nameof(CoapBlockStream)} with a {nameof(baseMessage)}.{nameof(baseMessage.Type)} of {baseMessage.Type}");

_writerTask = WriteBlocksAsync();


Expand Down

0 comments on commit dedc10a

Please sign in to comment.