encoding: Fixing bug in one of the Block constructors
Change-Id: I8ed98c8b9947e876e0f95864a7d83422b26e01fb
diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp
index 3451ffd..eaba9ba 100644
--- a/src/encoding/block.cpp
+++ b/src/encoding/block.cpp
@@ -81,9 +81,9 @@
m_value_end = m_end;
m_type = Tlv::readType(m_value_begin, m_value_end);
+ uint64_t length = Tlv::readVarNumber(m_value_begin, m_value_end);
if (verifyLength)
{
- uint64_t length = Tlv::readVarNumber(m_value_begin, m_value_end);
if (length != static_cast<uint64_t>(m_value_end - m_value_begin))
{
throw Tlv::Error("TLV length doesn't match buffer length");