summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextdocumentlayout.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-04-26 09:55:10 +0200
committerLiang Qi <liang.qi@qt.io>2018-04-26 09:55:10 +0200
commit866b47916dfcf2823b8fc4df719f1ebf15acef70 (patch)
treea4eef09d00d407dec26b99b9f094bf1f5093dcb8 /src/gui/text/qtextdocumentlayout.cpp
parenta9fc91466c2c143bea422d98af24755f43c2b97b (diff)
parent4bab1b0d7c2462ee9c5369c949b45bc4dedc1194 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm src/plugins/platforms/cocoa/qcocoawindow.mm Change-Id: Ideea96d1b43d47b1d9b34e11c9986a88e240aa71
Diffstat (limited to 'src/gui/text/qtextdocumentlayout.cpp')
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index d04dd08058..70132b542c 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -2474,7 +2474,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
QTextTableData *td = static_cast<QTextTableData *>(data(lastIt.currentFrame()));
QTextLayout *layout = block.layout();
- QFixed height = QFixed::fromReal(layout->lineAt(0).height());
+ QFixed height = layout->lineCount() > 0 ? QFixed::fromReal(layout->lineAt(0).height()) : QFixed();
if (layoutStruct->pageBottom == origPageBottom) {
layoutStruct->y -= height;
@@ -2486,10 +2486,12 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout
layoutBlock(block, docPos, blockFormat, layoutStruct, layoutFrom, layoutTo, previousBlockFormatPtr);
}
- QPointF linePos((td->position.x + td->size.width).toReal(),
- (td->position.y + td->size.height - height).toReal());
+ if (layout->lineCount() > 0) {
+ QPointF linePos((td->position.x + td->size.width).toReal(),
+ (td->position.y + td->size.height - height).toReal());
- layout->lineAt(0).setPosition(linePos - layout->position());
+ layout->lineAt(0).setPosition(linePos - layout->position());
+ }
}
if (blockFormat.pageBreakPolicy() & QTextFormat::PageBreak_AlwaysAfter)