diff options
Diffstat (limited to 'src/knx/core')
-rw-r--r-- | src/knx/core/qknxbytearray.cpp | 3 | ||||
-rw-r--r-- | src/knx/core/qknxbytearray.h | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/knx/core/qknxbytearray.cpp b/src/knx/core/qknxbytearray.cpp index 6a573d6..53ed547 100644 --- a/src/knx/core/qknxbytearray.cpp +++ b/src/knx/core/qknxbytearray.cpp @@ -243,6 +243,9 @@ void QKnxByteArray::clear() */ void QKnxByteArray::resize(int size) { + if (size == m_bytes.size()) + return; + if (size > m_bytes.size()) m_bytes.append(size - m_bytes.size(), 0x00); else diff --git a/src/knx/core/qknxbytearray.h b/src/knx/core/qknxbytearray.h index 4f1fdb1..efc1a02 100644 --- a/src/knx/core/qknxbytearray.h +++ b/src/knx/core/qknxbytearray.h @@ -92,7 +92,10 @@ public: void resize(int size); inline quint8 at(int i) const { return m_bytes.at(i); } - inline void set(int i, quint8 value) { m_bytes[i] = value; } + inline void set(int i, quint8 value) { + Q_ASSERT(i >= 0 && i < size()); + m_bytes[i] = value; + } inline void setValue(int i, quint8 value) { |