Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarkus Schorn2011-07-04 10:35:49 -0400
committerMarkus Schorn2011-07-04 10:35:49 -0400
commitbebd18a5b299d8ba3aa5e04b6f148065ba904a64 (patch)
tree60d16d7065e4fb75b7a7cc92f19dd6e49c03ca76 /core
parent58dbe6d73836c34145e3ce42ff3fbcaa165bfcfe (diff)
downloadorg.eclipse.cdt-bebd18a5b299d8ba3aa5e04b6f148065ba904a64.tar.gz
org.eclipse.cdt-bebd18a5b299d8ba3aa5e04b6f148065ba904a64.tar.xz
org.eclipse.cdt-bebd18a5b299d8ba3aa5e04b6f148065ba904a64.zip
Bug 351029: NPE resolving binding in copied AST.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
index 476f3a42bf..2599107a73 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPVisitor.java
@@ -1065,9 +1065,12 @@ public class CPPVisitor extends ASTQueries {
for (; i < names.length; i++) {
if (names[i] == name) break;
}
+ final IASTTranslationUnit tu = parent.getTranslationUnit();
if (i == 0) {
if (qname.isFullyQualified()) {
- return parent.getTranslationUnit().getScope();
+ if (tu == null)
+ return null;
+ return tu.getScope();
}
if (qname.getParent() instanceof ICPPASTFieldReference) {
name= qname;
@@ -1091,8 +1094,8 @@ public class CPPVisitor extends ASTQueries {
boolean done= true;
IScope scope= null;
if (binding instanceof ICPPClassType) {
- if (binding instanceof IIndexBinding) {
- binding= (((CPPASTTranslationUnit) parent.getTranslationUnit())).mapToAST((ICPPClassType) binding);
+ if (binding instanceof IIndexBinding && tu != null) {
+ binding= (((CPPASTTranslationUnit) tu)).mapToAST((ICPPClassType) binding);
}
scope= ((ICPPClassType) binding).getCompositeScope();
} else if (binding instanceof ICPPNamespace) {

Back to the top