From cc4935dc0641336813925b3892ffd6695d709d19 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 18 Jun 2009 14:28:25 +0200 Subject: qdoc: Fixed crash when a compact list section was empty. --- tools/qdoc3/htmlgenerator.cpp | 51 +++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index c14b46d..8ef4f0b 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1850,8 +1850,10 @@ HtmlGenerator::generateAnnotatedList(const Node *relative, out() << "

\n"; } -void HtmlGenerator::generateCompactList(const Node *relative, CodeMarker *marker, - const QMap &classMap) +void +HtmlGenerator::generateCompactList(const Node *relative, + CodeMarker *marker, + const QMap &classMap) { const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' const int NumColumns = 4; // number of columns in the result @@ -1994,28 +1996,29 @@ void HtmlGenerator::generateCompactList(const Node *relative, CodeMarker *marker << " "; } out() << "\n"; - - // bad loop - QMap::Iterator it; - it = paragraph[currentParagraphNo[i]].begin(); - for (j = 0; j < currentOffsetInParagraph[i]; j++) - ++it; - - out() << ""; - // Previously, we used generateFullName() for this, but we - // require some special formatting. - out() << ""; - QStringList pieces = fullName(it.value(), relative, marker).split("::"); - out() << protect(pieces.last()); - out() << ""; - if (pieces.size() > 1) { - out() << " ("; - generateFullName(it.value()->parent(), relative, marker); - out() << ")"; - } - out() << "\n"; + + if (!paragraphName[currentParagraphNo[i]].isEmpty()) { + QMap::Iterator it; + it = paragraph[currentParagraphNo[i]].begin(); + for (j = 0; j < currentOffsetInParagraph[i]; j++) + ++it; + + out() << ""; + // Previously, we used generateFullName() for this, but we + // require some special formatting. + out() << ""; + QStringList pieces = fullName(it.value(), relative, marker).split("::"); + out() << protect(pieces.last()); + out() << ""; + if (pieces.size() > 1) { + out() << " ("; + generateFullName(it.value()->parent(), relative, marker); + out() << ")"; + } + out() << "\n"; + } currentOffset[i]++; currentOffsetInParagraph[i]++; -- cgit v0.12