mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 342539 - java.lang.NullPointerException at InclusionProposalComputer.java:188
This commit is contained in:
parent
006a176b00
commit
706f09f885
1 changed files with 5 additions and 2 deletions
|
@ -123,6 +123,10 @@ public class InclusionProposalComputer implements ICompletionProposalComputer {
|
||||||
if (context.isContextInformationStyle()) {
|
if (context.isContextInformationStyle()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final ITranslationUnit tu= context.getTranslationUnit();
|
||||||
|
if (tu == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
String prefix;
|
String prefix;
|
||||||
boolean angleBrackets= false;
|
boolean angleBrackets= false;
|
||||||
prefix = computeIncludePrefix(context);
|
prefix = computeIncludePrefix(context);
|
||||||
|
@ -131,10 +135,9 @@ public class InclusionProposalComputer implements ICompletionProposalComputer {
|
||||||
prefix= prefix.substring(1);
|
prefix= prefix.substring(1);
|
||||||
}
|
}
|
||||||
IPath prefixPath= new Path(prefix);
|
IPath prefixPath= new Path(prefix);
|
||||||
final ITranslationUnit tu= context.getTranslationUnit();
|
|
||||||
String[] potentialIncludes= collectIncludeFiles(tu, prefixPath, angleBrackets);
|
String[] potentialIncludes= collectIncludeFiles(tu, prefixPath, angleBrackets);
|
||||||
if (potentialIncludes.length > 0) {
|
if (potentialIncludes.length > 0) {
|
||||||
IInclude[] includes= context.getTranslationUnit().getIncludes();
|
IInclude[] includes= tu.getIncludes();
|
||||||
Set<String> alreadyIncluded= new HashSet<String>();
|
Set<String> alreadyIncluded= new HashSet<String>();
|
||||||
for (IInclude includeDirective : includes) {
|
for (IInclude includeDirective : includes) {
|
||||||
alreadyIncluded.add(includeDirective.getElementName());
|
alreadyIncluded.add(includeDirective.getElementName());
|
||||||
|
|
Loading…
Add table
Reference in a new issue