mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +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
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* IBM Rational Software - Initial API and implementation
|
* IBM Rational Software - Initial API and implementation
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.core.dom.parser.c;
|
package org.eclipse.cdt.internal.core.dom.parser.c;
|
||||||
|
@ -75,11 +75,6 @@ public class CParameter extends PlatformObject implements IParameter {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see org.eclipse.cdt.core.dom.ast.IBinding#getName()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
IASTName name = getPrimaryDeclaration();
|
IASTName name = getPrimaryDeclaration();
|
||||||
|
@ -100,6 +95,9 @@ public class CParameter extends PlatformObject implements IParameter {
|
||||||
public IScope getScope() {
|
public IScope getScope() {
|
||||||
// IASTParameterDeclaration or IASTSimpleDeclaration
|
// IASTParameterDeclaration or IASTSimpleDeclaration
|
||||||
for (IASTName declaration : declarations) {
|
for (IASTName declaration : declarations) {
|
||||||
|
if (declaration == null)
|
||||||
|
break; // Skip nulls at the end of the declarations array
|
||||||
|
|
||||||
IASTNode parent = declaration.getParent();
|
IASTNode parent = declaration.getParent();
|
||||||
if (parent instanceof ICASTKnRFunctionDeclarator) {
|
if (parent instanceof ICASTKnRFunctionDeclarator) {
|
||||||
parent = parent.getParent();
|
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) {
|
public void addDeclaration(IASTName name) {
|
||||||
if (name != null && name.isActive())
|
if (name != null && name.isActive())
|
||||||
|
|
Loading…
Add table
Reference in a new issue