mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 375546 - Potential NullPointerException in CParameter.java
This commit is contained in:
parent
e6f0a47c44
commit
3606e0c512
1 changed files with 5 additions and 7 deletions
|
@ -75,11 +75,6 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
IASTName name = getPrimaryDeclaration();
|
||||
|
@ -100,6 +95,9 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
public IScope getScope() {
|
||||
// IASTParameterDeclaration or IASTSimpleDeclaration
|
||||
for (IASTName declaration : declarations) {
|
||||
if (declaration == null)
|
||||
break; // Skip nulls at the end of the declarations array
|
||||
|
||||
IASTNode parent = declaration.getParent();
|
||||
if (parent instanceof ICASTKnRFunctionDeclarator) {
|
||||
parent = parent.getParent();
|
||||
|
@ -120,7 +118,7 @@ public class CParameter extends PlatformObject implements IParameter {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param name the name from a parameter declaration
|
||||
*/
|
||||
public void addDeclaration(IASTName name) {
|
||||
if (name != null && name.isActive())
|
||||
|
|
Loading…
Add table
Reference in a new issue