1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Fixed an NPE.

Change-Id: I20e5a2c2a452159224cd8af5a3e0c434801b67cc
This commit is contained in:
Sergey Prigogin 2016-10-26 16:46:36 -07:00
parent d77511f4c4
commit 52f4104080

View file

@ -86,9 +86,12 @@ public class CPPFunctionScope extends CPPScope implements ICPPFunctionScope {
public IScope getParent() { public IScope getParent() {
// We can't just resolve the function and get its parent scope, since there are cases where that // We can't just resolve the function and get its parent scope, since there are cases where that
// could loop because resolving functions requires resolving their parameter types. // could loop because resolving functions requires resolving their parameter types.
IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) getPhysicalNode(); IASTFunctionDeclarator funcDeclarator = (IASTFunctionDeclarator) getPhysicalNode();
IASTName name = fdtor.getName().getLastName(); IASTName name = funcDeclarator.getName();
return CPPVisitor.getContainingNonTemplateScope(name); if (name != null)
return CPPVisitor.getContainingNonTemplateScope(name.getLastName());
return super.getParent();
} }
@Override @Override