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:
parent
4843da7365
commit
a224016462
1 changed files with 6 additions and 4 deletions
|
@ -280,8 +280,8 @@ public class CPPVisitor {
|
||||||
return enumeration;
|
return enumeration;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static IBinding createBinding( ICPPASTElaboratedTypeSpecifier elabType ){
|
private static IBinding createBinding( final ICPPASTElaboratedTypeSpecifier elabType ){
|
||||||
IASTNode parent = elabType.getParent();
|
final IASTNode parent = elabType.getParent();
|
||||||
IBinding binding = null;
|
IBinding binding = null;
|
||||||
boolean mustBeSimple = true;
|
boolean mustBeSimple = true;
|
||||||
boolean isFriend = false;
|
boolean isFriend = false;
|
||||||
|
@ -350,7 +350,9 @@ public class CPPVisitor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
binding = scope.getBinding( elabType.getName(), false );
|
if (scope != null) {
|
||||||
|
binding = scope.getBinding( elabType.getName(), false );
|
||||||
|
}
|
||||||
if( !(binding instanceof ICPPInternalBinding) || !(binding instanceof ICPPClassType) ){
|
if( !(binding instanceof ICPPInternalBinding) || !(binding instanceof ICPPClassType) ){
|
||||||
if( elabType.getKind() != IASTElaboratedTypeSpecifier.k_enum ){
|
if( elabType.getKind() != IASTElaboratedTypeSpecifier.k_enum ){
|
||||||
if( template )
|
if( template )
|
||||||
|
@ -2142,7 +2144,7 @@ public class CPPVisitor {
|
||||||
private static IScope getParentScope(IScope scope, IASTTranslationUnit unit) throws DOMException {
|
private static IScope getParentScope(IScope scope, IASTTranslationUnit unit) throws DOMException {
|
||||||
IScope parentScope= scope.getParent();
|
IScope parentScope= scope.getParent();
|
||||||
// the index cannot return the translation unit as parent scope
|
// 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();
|
parentScope= unit.getScope();
|
||||||
}
|
}
|
||||||
return parentScope;
|
return parentScope;
|
||||||
|
|
Loading…
Add table
Reference in a new issue