From 94032d89686c0b0a08df266cc07af707689dafc3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Mar 2018 14:30:52 +0100 Subject: QtXmlToSphinx::Table: Fix crash when having a rowspan > 1 in the last row Limit the number of added cells to the rowcount. Task-number: PYSIDE-363 Change-Id: I2b05ce97962d56650112b66fe99de0f5ea693abb Reviewed-by: Alexandru Croitor Reviewed-by: Cristian Maureira-Fredes --- sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sources') diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp index 3568080df..842c68b90 100644 --- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp @@ -1141,11 +1141,12 @@ void QtXmlToSphinx::Table::normalize() if (cell.rowSpan > 0) { QtXmlToSphinx::TableCell newCell; newCell.rowSpan = -1; - int max = std::min(cell.rowSpan - 1, count()); + int targetRow = row + 1; + const int targetEndRow = + std::min(targetRow + cell.rowSpan - 1, count()); cell.rowSpan = 0; - for (int i = 0; i < max; ++i) { - self[row+i+1].insert(col, newCell); - } + for ( ; targetRow < targetEndRow; ++targetRow) + self[targetRow].insert(col, newCell); row++; } } -- cgit v1.2.3