1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 03:45:35 +02:00

Fix for 192358, NPE in search.

This commit is contained in:
Markus Schorn 2007-06-13 09:07:44 +00:00
parent 2f99eaf29c
commit d32b854322

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006 QNX Software Systems and others. * Copyright (c) 2006, 2007 QNX Software Systems 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
@ -96,13 +96,18 @@ public class PDOMSearchTreeContentProvider implements ITreeContentProvider, IPDO
private void insertSearchElement(PDOMSearchElement element) { private void insertSearchElement(PDOMSearchElement element) {
IPath path = new Path(element.getFileName()); IPath path = new Path(element.getFileName());
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(path); IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(path);
boolean handled= false;
if (files.length > 0) { if (files.length > 0) {
for (int j = 0; j < files.length; ++j) { for (int j = 0; j < files.length; ++j) {
ICElement celement = CoreModel.getDefault().create(files[j]); ICElement celement = CoreModel.getDefault().create(files[j]);
insertChild(celement, element); if (celement != null) {
insertCElement(celement); insertChild(celement, element);
insertCElement(celement);
handled= true;
}
} }
} else { }
if (!handled) {
String pathName = path.toOSString(); String pathName = path.toOSString();
insertChild(pathName, element); insertChild(pathName, element);
insertChild(result, pathName); insertChild(result, pathName);