1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Sanity check for the start and length ranges.

This commit is contained in:
Alain Magloire 2003-04-07 16:52:40 +00:00
parent ec7c947a6f
commit 487ef8032a

View file

@ -592,6 +592,12 @@ public class CEditor extends TextEditor implements ISelectionChangedListener {
int start= element.getStartPos(); int start= element.getStartPos();
int length= element.getLength(); int length= element.getLength();
// Sanity check sometimes the parser may throw wrong numbers.
if (start < 0 || length < 0) {
start = 0;
length = 0;
}
// 0 length and start and non-zero start line says we know // 0 length and start and non-zero start line says we know
// the line for some reason, but not the offset. // the line for some reason, but not the offset.
if (length == 0 && start == 0 && element.getStartLine() != 0) { if (length == 0 && start == 0 && element.getStartLine() != 0) {