From 275da7f3749d99426ad107398f6f71e9c8db16c3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 20 Aug 2018 13:15:40 +0200 Subject: shiboken/doc generator: Fix crash when normalizing tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not rely on row 0 to obtain the maximum number of columns, search all instead. Change-Id: I6ddda89c191d1823b346e9e564f31a61de523426 Reviewed-by: Cristian Maureira-Fredes Reviewed-by: Topi Reiniƶ --- sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sources') diff --git a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp index e8f09df4a..b492ea49f 100644 --- a/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp +++ b/sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp @@ -1323,7 +1323,13 @@ void QtXmlToSphinx::Table::normalize() //QDoc3 generates tables with wrong number of columns. We have to //check and if necessary, merge the last columns. - int maxCols = self.at(0).count(); + int maxCols = -1; + for (const auto &row : qAsConst(self)) { + if (row.count() > maxCols) + maxCols = row.count(); + } + if (maxCols <= 0) + return; // add col spans for (row = 0; row < count(); ++row) { for (col = 0; col < at(row).count(); ++col) { -- cgit v1.2.3