diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qcontiguouscache.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index 18facf7e42..faa7263d6b 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -211,6 +211,7 @@ void QContiguousCache<T>::detach_helper() template <typename T> void QContiguousCache<T>::setCapacity(int asize) { + Q_ASSERT(asize >= 0); if (asize == d->alloc) return; detach(); @@ -285,6 +286,7 @@ inline QContiguousCacheData *QContiguousCache<T>::allocateData(int aalloc) template <typename T> QContiguousCache<T>::QContiguousCache(int cap) { + Q_ASSERT(cap >= 0); d = allocateData(cap); d->ref.store(1); d->alloc = cap; |