1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for potential NPEs, bug 221796.

This commit is contained in:
Markus Schorn 2008-03-07 08:48:05 +00:00
parent c7dcddf83f
commit fcd3e477bd
2 changed files with 7 additions and 3 deletions

View file

@ -1,12 +1,13 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2005 IBM Corporation and others. * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* IBM - Initial API and implementation * IBM - Initial API and implementation
* Markus Schorn (Wind River Systems)
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp; package org.eclipse.cdt.internal.core.dom.parser.cpp;
@ -122,7 +123,7 @@ public class CPPImplicitFunction extends CPPFunction implements ICPPFunction, IC
((CPPParameter)binding).addDeclaration( n ); ((CPPParameter)binding).addDeclaration( n );
} }
if( declarations != null ){ if( declarations != null ){
for( int j = 0; j < declarations.length; j++ ){ for( int j = 0; j < declarations.length && declarations[j] != null; j++ ){
temp = declarations[j].getParameters()[i]; temp = declarations[j].getParameters()[i];
IASTName n = temp.getDeclarator().getName(); IASTName n = temp.getDeclarator().getName();
n.setBinding( binding ); n.setBinding( binding );

View file

@ -84,6 +84,9 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
if( declarations != null ){ if( declarations != null ){
for( int i = 0; i < declarations.length; i++ ){ for( int i = 0; i < declarations.length; i++ ){
IASTDeclarator dtor = declarations[i]; IASTDeclarator dtor = declarations[i];
if (dtor == null) {
break;
}
while( dtor.getParent() instanceof IASTDeclarator ) while( dtor.getParent() instanceof IASTDeclarator )
dtor = (IASTDeclarator) dtor.getParent(); dtor = (IASTDeclarator) dtor.getParent();
IASTDeclaration decl = (IASTDeclaration) dtor.getParent(); IASTDeclaration decl = (IASTDeclaration) dtor.getParent();