summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-03-21 09:30:51 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2011-03-21 09:34:30 (GMT)
commitfda299f55dd5aeb2d075f6f5c842f75c9f559f9c (patch)
tree6b8be857b8ee7c7bf6a9746be0a72b6a05be0990 /src
parentc2317645b94f9a3004d76dda558c4a2b853a1489 (diff)
downloadQt-fda299f55dd5aeb2d075f6f5c842f75c9f559f9c.zip
Qt-fda299f55dd5aeb2d075f6f5c842f75c9f559f9c.tar.gz
Qt-fda299f55dd5aeb2d075f6f5c842f75c9f559f9c.tar.bz2
Don't crash calling QTextDocument::blockBoundingRect on invalid block
If the block is invalid, QTextBlock::layout() will return 0 and we would dereference a null pointer. Task-number: QTBUG-18192 Reviewed-by: Jiang Jiang
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index d721c91..65fe0f8 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -3133,7 +3133,7 @@ QRectF QTextDocumentLayoutPrivate::frameBoundingRectInternal(QTextFrame *frame)
QRectF QTextDocumentLayout::blockBoundingRect(const QTextBlock &block) const
{
Q_D(const QTextDocumentLayout);
- if (d->docPrivate->pageSize.isNull())
+ if (d->docPrivate->pageSize.isNull() || !block.isValid())
return QRectF();
d->ensureLayoutedByPosition(block.position() + block.length());
QTextFrame *frame = d->document->frameAt(block.position());