1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fixes a NPE in the name-resolution (bug 217414)

This commit is contained in:
Markus Schorn 2008-02-01 15:20:35 +00:00
parent 4843da7365
commit a224016462

View file

@ -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 {
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;