1
0
Fork 0
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:
Anton Leherbauer 2011-04-12 13:56:01 +00:00
parent 006a176b00
commit 706f09f885

View file

@ -123,6 +123,10 @@ public class InclusionProposalComputer implements ICompletionProposalComputer {
if (context.isContextInformationStyle()) {
return;
}
final ITranslationUnit tu= context.getTranslationUnit();
if (tu == null) {
return;
}
String prefix;
boolean angleBrackets= false;
prefix = computeIncludePrefix(context);
@ -131,10 +135,9 @@ public class InclusionProposalComputer implements ICompletionProposalComputer {
prefix= prefix.substring(1);
}
IPath prefixPath= new Path(prefix);
final ITranslationUnit tu= context.getTranslationUnit();
String[] potentialIncludes= collectIncludeFiles(tu, prefixPath, angleBrackets);
if (potentialIncludes.length > 0) {
IInclude[] includes= context.getTranslationUnit().getIncludes();
IInclude[] includes= tu.getIncludes();
Set<String> alreadyIncluded= new HashSet<String>();
for (IInclude includeDirective : includes) {
alreadyIncluded.add(includeDirective.getElementName());