未验证 提交 1b18ac9f 编写于 作者: R Ramon Smits 提交者: GitHub

Resolve ConvertPayloadToString resulting in ArgumentNullException (#1745)

Resolve breaking change where previously ConvertPayloadToString returned null if the payload was null
上级 2cdad662
......@@ -4,6 +4,7 @@
using System;
using System.Text;
using MQTTnet.Internal;
namespace MQTTnet
{
......@@ -16,6 +17,11 @@ namespace MQTTnet
throw new ArgumentNullException(nameof(applicationMessage));
}
if(applicationMessage.PayloadSegment == EmptyBuffer.ArraySegment)
{
return null;
}
var payloadSegment = applicationMessage.PayloadSegment;
return Encoding.UTF8.GetString(payloadSegment.Array, payloadSegment.Offset, payloadSegment.Count);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册