diff --git a/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs b/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs index b320fe4..d90baf3 100644 --- a/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs +++ b/Modbus.Net/Modbus.Net/Controller/DuplicateWithCount.cs @@ -32,6 +32,7 @@ namespace Modbus.Net { length = length * 256 + receiveMessage[pos + countPos]; } + if (length == 0) { break; } length += otherCount; if (pos + length > receiveMessage.Length) break; byte[] currentPackage = new byte[length];