QList::count(T): remove the &* hack on iterators
Use data() and data() + size() instead. This solves an UB when the list is in its default-constructed state, for which constData() == nullptr. Pick-to: 6.2 Fixes: QTBUG-98770 Change-Id: I2cffe62afda945079b63fffd16bc165978c769f6 Reviewed-by: Marc Mutz <marc.mutz@qt.io>bb10
parent
60d9509cb0
commit
6855b80eae
|
|
@ -585,7 +585,7 @@ public:
|
|||
template <typename AT = T>
|
||||
qsizetype count(const AT &t) const noexcept
|
||||
{
|
||||
return qsizetype(std::count(&*cbegin(), &*cend(), t));
|
||||
return qsizetype(std::count(data(), data() + size(), t));
|
||||
}
|
||||
|
||||
void removeAt(qsizetype i) { remove(i); }
|
||||
|
|
|
|||
Loading…
Reference in New Issue