Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2008-03-07 08:48:05 +0000
committerMarkus Schorn2008-03-07 08:48:05 +0000
commitfcd3e477bda8fde67bd9863be44b0f89d412eed7 (patch)
tree215f57b7e2e72c582dfd9d18a091cd61a9a22f6b /core/org.eclipse.cdt.core/parser
parentc7dcddf83f1a823165ca50d520cf471e3267b2b4 (diff)
downloadorg.eclipse.cdt-fcd3e477bda8fde67bd9863be44b0f89d412eed7.tar.gz
org.eclipse.cdt-fcd3e477bda8fde67bd9863be44b0f89d412eed7.tar.xz
org.eclipse.cdt-fcd3e477bda8fde67bd9863be44b0f89d412eed7.zip
Fix for potential NPEs, bug 221796.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitFunction.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java3
2 files changed, 7 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitFunction.java
index cc562fcb7aa..0277db93e26 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitFunction.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitFunction.java
@@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* 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;
@@ -122,7 +123,7 @@ public class CPPImplicitFunction extends CPPFunction implements ICPPFunction, IC
((CPPParameter)binding).addDeclaration( n );
}
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];
IASTName n = temp.getDeclarator().getName();
n.setBinding( binding );
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java
index bc723df6d6d..1c28193542e 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPMethod.java
@@ -84,6 +84,9 @@ public class CPPMethod extends CPPFunction implements ICPPMethod {
if( declarations != null ){
for( int i = 0; i < declarations.length; i++ ){
IASTDeclarator dtor = declarations[i];
+ if (dtor == null) {
+ break;
+ }
while( dtor.getParent() instanceof IASTDeclarator )
dtor = (IASTDeclarator) dtor.getParent();
IASTDeclaration decl = (IASTDeclaration) dtor.getParent();

Back to the top