QByteDataBuffer: assert an undocumented precondition
The alternative would be to return a null QByteArray, but the current implementation makes calling read() on an empty QByteDataBuffer UB, so this is behavior-preserving, just with a bit nicer error message. Change-Id: Ia9db7acbfa47e601b466d6cc6a728859065c27b5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit 011b68d3cd95295890b1ed724aa4331ff5680eed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
a905c3e683
commit
a4b3fc4121
@ -105,6 +105,7 @@ public:
|
||||
// preferably use this function to read data.
|
||||
inline QByteArray read()
|
||||
{
|
||||
Q_ASSERT(!isEmpty());
|
||||
squeezeFirst();
|
||||
bufferCompleteSize -= buffers.first().size();
|
||||
return buffers.takeFirst();
|
||||
|
Loading…
x
Reference in New Issue
Block a user