mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 06:55:23 +02:00
Bug 314303: Protect against NPE.
This commit is contained in:
parent
27f89cdca5
commit
825017ddae
1 changed files with 13 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2008 Wind River Systems and others.
|
||||
* Copyright (c) 2007, 2010 Wind River 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
|
||||
|
@ -82,13 +82,21 @@ public class CSourceLookup extends AbstractDsfService implements ISourceLookup {
|
|||
for (int i = 0; i < containers.length; ++i) {
|
||||
if (containers[i] instanceof ProjectSourceContainer) {
|
||||
IProject project = ((ProjectSourceContainer)containers[i]).getProject();
|
||||
if (project != null && project.exists())
|
||||
list.add(project.getLocation().toPortableString());
|
||||
if (project != null && project.exists()) {
|
||||
IPath location = project.getLocation();
|
||||
if (location != null) {
|
||||
list.add(location.toPortableString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (containers[i] instanceof FolderSourceContainer) {
|
||||
IContainer container = ((FolderSourceContainer)containers[i]).getContainer();
|
||||
if (container != null && container.exists())
|
||||
list.add(container.getLocation().toPortableString());
|
||||
if (container != null && container.exists()) {
|
||||
IPath location = container.getLocation();
|
||||
if (location != null) {
|
||||
list.add(location.toPortableString());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (containers[i] instanceof DirectorySourceContainer) {
|
||||
File dir = ((DirectorySourceContainer)containers[i]).getDirectory();
|
||||
|
|
Loading…
Add table
Reference in a new issue