From e7998dc187cf8f1218711ac963c441afbea1577c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 27 Oct 2018 19:43:09 -0700 Subject: QCborStreamReader: make sure setDevice() clears the last error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The unit tests weren't running into this problem because the every setDevice() was preceded by the object being initialized with the exact same data, so there was never a previous error state. I've only changed a couple of tests, left the other setDevice() unchanged so we test both behaviors. Fixes: QTBUG-71426 Change-Id: I1bd327aeaf73421a8ec5fffd1561a590e3933376 Reviewed-by: Nils Jeisecke Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Edward Welbourne --- src/corelib/serialization/qcborstream.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib/serialization/qcborstream.cpp') diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp index 22286188b8..fc5610e341 100644 --- a/src/corelib/serialization/qcborstream.cpp +++ b/src/corelib/serialization/qcborstream.cpp @@ -1779,6 +1779,8 @@ public: preread(); if (CborError err = cbor_parser_init_reader(nullptr, &parser, ¤tElement, this)) handleError(err); + else + lastError = { QCborError::NoError }; } char *bufferPtr() -- cgit v1.2.3