diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qcontiguouscache.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index 70a19cc..55ebd5e 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -346,6 +346,8 @@ void QContiguousCache<T>::free(Data *x) template <typename T> void QContiguousCache<T>::append(const T &value) { + if (!d->alloc) + return; // zero capacity detach(); if (QTypeInfo<T>::isComplex) { if (d->count == d->alloc) @@ -367,6 +369,8 @@ void QContiguousCache<T>::append(const T &value) template<typename T> void QContiguousCache<T>::prepend(const T &value) { + if (!d->alloc) + return; // zero capacity detach(); if (d->start) d->start--; @@ -390,6 +394,8 @@ template<typename T> void QContiguousCache<T>::insert(int pos, const T &value) { Q_ASSERT_X(pos >= 0 && pos < INT_MAX, "QContiguousCache<T>::insert", "index out of range"); + if (!d->alloc) + return; // zero capacity detach(); if (containsIndex(pos)) { if (QTypeInfo<T>::isComplex) { |