mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +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
|
@ -6,7 +6,7 @@
|
|||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* IBM Rational Software - Initial API and implementation
|
||||
* Markus Schorn (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||
|
@ -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