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:
parent
ec7c947a6f
commit
487ef8032a
1 changed files with 7 additions and 1 deletions
|
@ -592,6 +592,12 @@ public class CEditor extends TextEditor implements ISelectionChangedListener {
|
|||
int start= element.getStartPos();
|
||||
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
|
||||
// the line for some reason, but not the offset.
|
||||
if (length == 0 && start == 0 && element.getStartLine() != 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue