1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Fix NoSuchElementException if no comment

This commit is contained in:
Anton Leherbauer 2006-09-12 12:57:44 +00:00
parent fc309c3e02
commit db3183d89f

View file

@ -1252,18 +1252,20 @@ public class DefaultCFoldingStructureProvider implements ICFoldingStructureProvi
comments.add(new Tuple(new CProjectionAnnotation(collapse, doc.get(projection.offset, Math.min(16, projection.length)), true), projection));
}
}
// first comment is header comment
Iterator iter = comments.iterator();
Tuple tuple = (Tuple) iter.next();
if (ctx.collapseHeaderComments()) {
tuple.annotation.markCollapsed();
} else {
tuple.annotation.markExpanded();
}
ctx.addProjectionRange(tuple.annotation, tuple.position);
while (iter.hasNext()) {
tuple = (Tuple) iter.next();
if (!comments.isEmpty()) {
// first comment is header comment
Iterator iter = comments.iterator();
Tuple tuple = (Tuple) iter.next();
if (ctx.collapseHeaderComments()) {
tuple.annotation.markCollapsed();
} else {
tuple.annotation.markExpanded();
}
ctx.addProjectionRange(tuple.annotation, tuple.position);
while (iter.hasNext()) {
tuple = (Tuple) iter.next();
ctx.addProjectionRange(tuple.annotation, tuple.position);
}
}
}