diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index b6da6eb8c3d..65f70a36343 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -1883,16 +1883,27 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv if (container instanceof CProjectSourceContainer) { IProject project = ((CProjectSourceContainer) container).getProject(); - if (project != null && project.exists()) - pathToAdd = project.getLocation().toPortableString(); + if (project != null && project.exists()) { + IPath location = project.getLocation(); + if (location != null) { + pathToAdd = location.toPortableString(); + } + } } else if (container instanceof ProjectSourceContainer) { // For backward compatibility IProject project = ((ProjectSourceContainer) container).getProject(); - if (project != null && project.exists()) - pathToAdd = project.getLocation().toPortableString(); + if (project != null && project.exists()) { + IPath location = project.getLocation(); + if (location != null) { + pathToAdd = location.toPortableString(); + } + } } else if (container instanceof FolderSourceContainer) { IContainer folderContainer = ((FolderSourceContainer) container).getContainer(); if (folderContainer != null && folderContainer.exists()) { - pathToAdd = folderContainer.getLocation().toPortableString(); + IPath location = folderContainer.getLocation(); + if (location != null) { + pathToAdd = location.toPortableString(); + } } } if (container instanceof DirectorySourceContainer) { File dir = ((DirectorySourceContainer) container).getDirectory();