1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-16 05:25:21 +02:00

Bug 541117 - NPE in CElementHyperlinkDetector.isLanguageKeyword

Change-Id: I4bd2155de5aa7a09cb9e68f57e1168bdaab76401
This commit is contained in:
Nathan Ridge 2018-11-15 21:50:40 -05:00
parent 0c7b32c0dd
commit ac68d83566

View file

@ -206,12 +206,14 @@ public class CElementHyperlinkDetector extends AbstractHyperlinkDetector {
*/
private static IRegion getIdentifier(IDocument document, int offset, ILanguage language)
throws BadLocationException {
IRegion wordRegion = CWordFinder.findWord(document, offset);
if (wordRegion != null && wordRegion.getLength() > 0) {
String word = document.get(wordRegion.getOffset(), wordRegion.getLength());
if (!Character.isDigit(word.charAt(0))) {
if (SemanticUtil.isAutoOrDecltype(word) || !isLanguageKeyword(language, word)) {
return wordRegion;
if (language != null) {
IRegion wordRegion = CWordFinder.findWord(document, offset);
if (wordRegion != null && wordRegion.getLength() > 0) {
String word = document.get(wordRegion.getOffset(), wordRegion.getLength());
if (!Character.isDigit(word.charAt(0))) {
if (SemanticUtil.isAutoOrDecltype(word) || !isLanguageKeyword(language, word)) {
return wordRegion;
}
}
}
}