diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-03-21 09:30:51 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-03-21 09:34:30 (GMT) |
commit | fda299f55dd5aeb2d075f6f5c842f75c9f559f9c (patch) | |
tree | 6b8be857b8ee7c7bf6a9746be0a72b6a05be0990 /src/gui/text/qtextdocumentlayout.cpp | |
parent | c2317645b94f9a3004d76dda558c4a2b853a1489 (diff) | |
download | Qt-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/gui/text/qtextdocumentlayout.cpp')
-rw-r--r-- | src/gui/text/qtextdocumentlayout.cpp | 2 |
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()); |