1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

bug 369693: Using a workspace root as include paths causes NPE in

Project Explorer
This commit is contained in:
Andrew Gvozdev 2012-01-25 11:20:39 -05:00
parent e8a9e67b8c
commit a6ca3ea235

View file

@ -111,11 +111,12 @@ public class CViewLabelProvider extends AppearanceAwareLabelProvider {
String imageKey = null;
if (element instanceof IncludeReferenceProxy) {
IIncludeReference reference = ((IncludeReferenceProxy)element).getReference();
IContainer container = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(reference.getPath());
if (container != null) {
IContainer containerInclude = ResourcesPlugin.getWorkspace().getRoot().getContainerForLocation(reference.getPath());
if (containerInclude != null) {
ICProject cproject = reference.getCProject();
IProject project = (cproject != null) ? cproject.getProject() : null;
boolean isProjectRelative = container.getProject().equals(project);
IProject projectInclude = containerInclude.getProject();
boolean isProjectRelative = projectInclude != null && projectInclude.equals(project);
imageKey = LanguageSettingsImages.getImageKey(ICSettingEntry.INCLUDE_PATH, ICSettingEntry.VALUE_WORKSPACE_PATH, isProjectRelative);
} else {
imageKey = CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER;