Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2008-02-01 15:20:35 +0000
committerMarkus Schorn2008-02-01 15:20:35 +0000
commita2240164625dc34894eed1a06a796eb3750ca829 (patch)
tree3ca90923e11093d7017024779e1c0a9282756674 /core/org.eclipse.cdt.core/parser
parent4843da7365ed804067dbb02bdd6b0b3203a14e9c (diff)
downloadorg.eclipse.cdt-a2240164625dc34894eed1a06a796eb3750ca829.tar.gz
org.eclipse.cdt-a2240164625dc34894eed1a06a796eb3750ca829.tar.xz
org.eclipse.cdt-a2240164625dc34894eed1a06a796eb3750ca829.zip
Fixes a NPE in the name-resolution (bug 217414)
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java
index a7b9358eb61..22bc6bfbfd7 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPVisitor.java
@@ -280,8 +280,8 @@ public class CPPVisitor {
return enumeration;
}
- private static IBinding createBinding( ICPPASTElaboratedTypeSpecifier elabType ){
- IASTNode parent = elabType.getParent();
+ private static IBinding createBinding( final ICPPASTElaboratedTypeSpecifier elabType ){
+ final IASTNode parent = elabType.getParent();
IBinding binding = null;
boolean mustBeSimple = true;
boolean isFriend = false;
@@ -350,7 +350,9 @@ public class CPPVisitor {
}
}
try {
- binding = scope.getBinding( elabType.getName(), false );
+ if (scope != null) {
+ binding = scope.getBinding( elabType.getName(), false );
+ }
if( !(binding instanceof ICPPInternalBinding) || !(binding instanceof ICPPClassType) ){
if( elabType.getKind() != IASTElaboratedTypeSpecifier.k_enum ){
if( template )
@@ -2142,7 +2144,7 @@ public class CPPVisitor {
private static IScope getParentScope(IScope scope, IASTTranslationUnit unit) throws DOMException {
IScope parentScope= scope.getParent();
// the index cannot return the translation unit as parent scope
- if (parentScope == null && scope instanceof IIndexScope) {
+ if (parentScope == null && scope instanceof IIndexScope && unit != null) {
parentScope= unit.getScope();
}
return parentScope;

Back to the top