Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2011-04-12 13:56:14 +0000
committerAnton Leherbauer2011-04-12 13:56:14 +0000
commitf43d4813f69e56f895ba1d59f38ffb35171b0ab5 (patch)
tree169666ee933937cb573425b7b351310647abca84
parent2ba0eb66cd4e9085e6f7d8902bf67e166d0d1254 (diff)
downloadorg.eclipse.cdt-f43d4813f69e56f895ba1d59f38ffb35171b0ab5.tar.gz
org.eclipse.cdt-f43d4813f69e56f895ba1d59f38ffb35171b0ab5.tar.xz
org.eclipse.cdt-f43d4813f69e56f895ba1d59f38ffb35171b0ab5.zip
Bug 342539 - java.lang.NullPointerException at InclusionProposalComputer.java:188
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java
index 05dd50d1e8f..9c59a0db66f 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/InclusionProposalComputer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems, Inc. and others.
+ * Copyright (c) 2008, 2011 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -119,6 +119,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);
@@ -127,10 +131,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());

Back to the top