diff options
author | Bruno dos Santos de Araujo <bruno.araujo@openbossa.org> | 2009-12-16 08:50:48 -0400 |
---|---|---|
committer | Lauro Neto <lauro.neto@openbossa.org> | 2009-12-16 13:25:27 -0300 |
commit | bd98924d1a335fb34e3119a58bae3c0d42493c26 (patch) | |
tree | 2e8e9172756a5f82ba09b47141f9044eddaa704a | |
parent | 6bdce6ad951e10b3830b8a6a763961038e1f7828 (diff) |
Add constraint to avoid index out-of-range errors
Reviewer: Lauro Neto <lauro.neto@openbossa.org>
-rw-r--r-- | generators/qtdoc/qtdocgenerator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/generators/qtdoc/qtdocgenerator.cpp b/generators/qtdoc/qtdocgenerator.cpp index 47028813f..03807d525 100644 --- a/generators/qtdoc/qtdocgenerator.cpp +++ b/generators/qtdoc/qtdocgenerator.cpp @@ -742,7 +742,7 @@ QTextStream& operator<<(QTextStream& s, const QtXmlToSphinx::Table &table) QVector<int> rowHeights(table.count()); for (int i = 0, maxI = table.count(); i < maxI; ++i) { const QtXmlToSphinx::TableRow& row = table[i]; - for (int j = 0, maxJ = row.count(); j < maxJ; ++j) { + for (int j = 0, maxJ = std::min(row.count(), colWidths.size()); j < maxJ; ++j) { QStringList rowLines = row[j].data.split('\n'); // cache this would be a good idea foreach (QString str, rowLines) colWidths[j] = std::max(colWidths[j], str.count()); @@ -781,7 +781,7 @@ QTextStream& operator<<(QTextStream& s, const QtXmlToSphinx::Table &table) // Print the table cells for (int rowLine = 0; rowLine < rowHeights[i]; ++rowLine) { // for each line in a row - for (int j = 0, maxJ = row.count(); j < maxJ; ++j) { // for each column + for (int j = 0, maxJ = std::min(row.count(), colWidths.size()); j < maxJ; ++j) { // for each column const QtXmlToSphinx::TableCell& cell = row[j]; QStringList rowLines = cell.data.split('\n'); // FIXME: Cache this!!! if (!j) // First column, so we need print the identation |