diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qringbuffer_p.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index 2f208d21e3..afd15c85ea 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -369,9 +369,13 @@ public: // append a new buffer to the end inline void append(const QByteArray &qba) { - buffers[tailBuffer].resize(tail); - buffers << qba; - ++tailBuffer; + if (tail == 0) { + buffers.last() = qba; + } else { + buffers.last().resize(tail); + buffers << qba; + ++tailBuffer; + } tail = qba.length(); bufferSize += qba.length(); } |