Commit 74a37991340685ff9cf7a7570da8360fd7189014
1 parent
4a702421
Fix reading disconnect packets without reason code
Showing
1 changed file
with
2 additions
and
2 deletions
mqttpacket.cpp
| @@ -801,10 +801,10 @@ void MqttPacket::handleDisconnect() | @@ -801,10 +801,10 @@ void MqttPacket::handleDisconnect() | ||
| 801 | 801 | ||
| 802 | if (this->protocolVersion >= ProtocolVersion::Mqtt5) | 802 | if (this->protocolVersion >= ProtocolVersion::Mqtt5) |
| 803 | { | 803 | { |
| 804 | - reasonCode = static_cast<ReasonCodes>(readByte()); | ||
| 805 | - | ||
| 806 | if (!atEnd()) | 804 | if (!atEnd()) |
| 807 | { | 805 | { |
| 806 | + reasonCode = static_cast<ReasonCodes>(readByte()); | ||
| 807 | + | ||
| 808 | const size_t proplen = decodeVariableByteIntAtPos(); | 808 | const size_t proplen = decodeVariableByteIntAtPos(); |
| 809 | const size_t prop_end_at = pos + proplen; | 809 | const size_t prop_end_at = pos + proplen; |
| 810 | 810 |