QCborValue: Silence Coverity warning about null-pointer dereference

It's a false positive, since we've checked that the item HasByteData.
But it's cheap to rewrite so the warning is silenced.

>>>     CID 190741:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing a null pointer "this->byteData(idx)".

Change-Id: If48c5c2e920c433298f1fffd153f7534be42a30b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
Thiago Macieira 2018-07-08 10:34:27 -07:00
parent 6fd98af332
commit 503646a331
1 changed files with 2 additions and 2 deletions

View File

@ -205,8 +205,8 @@ public:
e.container->deref();
e.container = nullptr;
e.flags = {};
} else if (e.flags & QtCbor::Element::HasByteData) {
usedData -= byteData(idx)->len + sizeof(QtCbor::ByteData);
} else if (auto b = byteData(e)) {
usedData -= b->len + sizeof(QtCbor::ByteData);
}
replaceAt_internal(e, value, disp);
}