summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qstring.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-03-02 15:41:05 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2010-03-02 17:10:38 (GMT)
commit7fc63dd0ff368a637dcd17e692b9d6b26278b538 (patch)
treee4535c4ebb615b52e347a97158efe40247f23a16 /src/corelib/tools/qstring.cpp
parent120905fbc48ac7658fac392113bf45e00880c456 (diff)
downloadQt-7fc63dd0ff368a637dcd17e692b9d6b26278b538.zip
Qt-7fc63dd0ff368a637dcd17e692b9d6b26278b538.tar.gz
Qt-7fc63dd0ff368a637dcd17e692b9d6b26278b538.tar.bz2
QString::section: Fix crash with SectionIncludeLeadingSep flag
And start is out of bounds. Reviewed-by: Thiago Reviewed-by: Joao Task-number: QTBUG-4306
Diffstat (limited to 'src/corelib/tools/qstring.cpp')
-rw-r--r--src/corelib/tools/qstring.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 3ef0e66..03bc053 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -3185,7 +3185,7 @@ QString QString::section(const QRegExp &reg, int start, int end, SectionFlags fl
if (!empty || !(flags & SectionSkipEmpty))
x++;
}
- if((flags & SectionIncludeLeadingSep)) {
+ if((flags & SectionIncludeLeadingSep) && first_i < sections.size()) {
const qt_section_chunk &section = sections.at(first_i);
ret.prepend(section.string.left(section.length));
}