From 9fb1c6978973df8f55058f2a8900524be78cea0f Mon Sep 17 00:00:00 2001 From: Anton Leherbauer Date: Wed, 16 Jan 2008 16:48:01 +0000 Subject: [PATCH] Fix 2 NPEs --- .../org/eclipse/cdt/internal/core/model/TranslationUnit.java | 3 ++- .../cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java index 233d7caa650..c496de54972 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 QNX Software Systems and others. + * Copyright (c) 2000, 2008 QNX Software Systems 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 @@ -101,6 +101,7 @@ public class TranslationUnit extends Openable implements ITranslationUnit { public TranslationUnit(ICElement parent, URI uri, String idType) { super(parent, (IResource)null, uri.toString(), ICElement.C_UNIT); + location= uri; setContentTypeID(idType); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java index 344451afde3..756acef6466 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPImplicitMethod.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2007 IBM Corporation and others. + * Copyright (c) 2004, 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 @@ -78,6 +78,9 @@ public class CPPImplicitMethod extends CPPImplicitFunction implements ICPPMethod //first check if we already know it if( declarations != null ){ for( int i = 0; i < declarations.length; i++ ){ + if (declarations[i] == null) { + break; + } IASTDeclaration decl = (IASTDeclaration) declarations[i].getParent(); if( decl.getParent() instanceof ICPPASTCompositeTypeSpecifier ) return decl;