diff options
author | Liang Qi <liang.qi@nokia.com> | 2011-05-16 08:48:05 (GMT) |
---|---|---|
committer | Liang Qi <liang.qi@nokia.com> | 2011-05-16 08:48:05 (GMT) |
commit | 8befc4982a32752e48c82cacbed045e7336a3569 (patch) | |
tree | a5fec8f49847c517ca84496ca4b98c347cc06c1a /src/corelib | |
parent | ba564e089134980200c1c71879f2474135bee5fa (diff) | |
download | Qt-8befc4982a32752e48c82cacbed045e7336a3569.zip Qt-8befc4982a32752e48c82cacbed045e7336a3569.tar.gz Qt-8befc4982a32752e48c82cacbed045e7336a3569.tar.bz2 |
Fix a regression in QList::mid()
It doesn't need to copy anything when pos is after size().
Task-number: QTBUG-19164
Reviewed-by: Oswald Buddenhagen
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/tools/qlist.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index d30f8b1..97bf5fa 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -628,6 +628,8 @@ Q_OUTOFLINE_TEMPLATE QList<T> QList<T>::mid(int pos, int alength) const if (pos == 0 && alength == size()) return *this; QList<T> cpy; + if (alength <= 0) + return cpy; cpy.reserve(alength); cpy.d->end = alength; QT_TRY { |