From 33d6e7c0dbb3b9d0747ce644675f582b9dc5d589 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Thu, 10 Apr 2014 16:17:48 -0400 Subject: [PATCH] Bug 335180 - Remote debugging and virtual folders => java.lang.NullPointerException --- .../internal/core/model/CDebugTarget.java | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) 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();