diff options
author | Jiang Jiang <jiang.jiang@nokia.com> | 2011-01-07 15:15:25 (GMT) |
---|---|---|
committer | Jiang Jiang <jiang.jiang@nokia.com> | 2011-01-07 15:28:25 (GMT) |
commit | 64852122ba71bbb297b4f1e440f6fabee16ca2fe (patch) | |
tree | c493d382210cb18ec75b5e5d1451d9cea41e7014 /src/gui | |
parent | 7a54885b1df9baf793374e3cb9fdf8be93ee7c80 (diff) | |
download | Qt-64852122ba71bbb297b4f1e440f6fabee16ca2fe.zip Qt-64852122ba71bbb297b4f1e440f6fabee16ca2fe.tar.gz Qt-64852122ba71bbb297b4f1e440f6fabee16ca2fe.tar.bz2 |
Fix crash in QTextBlock::next()/previous()
We should check not just p but also n in next()/previous(),
which is what isValid() does. Otherwise n == 0 will cause
crash in QFragmentMap.
Task-number: QTBUG-16279
Reviewed-by: Eskil
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qtextobject.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index ea2ef2d..4b92379 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -1488,7 +1488,7 @@ QTextBlock::iterator QTextBlock::end() const */ QTextBlock QTextBlock::next() const { - if (!p) + if (!isValid()) return QTextBlock(); return QTextBlock(p, p->blockMap().next(n)); @@ -1504,7 +1504,7 @@ QTextBlock QTextBlock::next() const */ QTextBlock QTextBlock::previous() const { - if (!p) + if (!isValid()) return QTextBlock(); return QTextBlock(p, p->blockMap().previous(n)); |