Avoid crashes when calling squeeze()

Avoid crashes when calling squeeze() on a QList with non zero capacity
but zero size.

Change-Id: Id470b2d52266a345b94bc3dc5483f4668fbb57dc
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Lars Knoll 2020-11-04 11:09:49 +01:00
parent 837a29b0b9
commit 13fcd02ff9

View File

@ -187,7 +187,7 @@ public:
qsizetype detachCapacity(qsizetype newSize) const noexcept { return d ? d->detachCapacity(newSize) : newSize; }
const typename Data::ArrayOptions flags() const noexcept { return d ? typename Data::ArrayOption(d->flags) : Data::ArrayOptionDefault; }
void setFlag(typename Data::ArrayOptions f) noexcept { Q_ASSERT(d); d->flags |= f; }
void clearFlag(typename Data::ArrayOptions f) noexcept { Q_ASSERT(d); d->flags &= ~f; }
void clearFlag(typename Data::ArrayOptions f) noexcept { if (d) d->flags &= ~f; }
Data *d_ptr() noexcept { return d; }
void setBegin(T *begin) noexcept { ptr = begin; }