From dbcc86e5c5e1f7b3b3291abbaaaa138cb60f2734 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Thu, 4 Dec 2008 21:57:52 +0000 Subject: [PATCH] Fixed NPE caused by rev 1.31 in following scenario: you open a C file with File > Open that is not in the workspace, then create a breakpoint (double-click). Selecting the breakpoint in the Breakpoints view would result in an NPE. --- .../debug/internal/ui/CDebugModelPresentation.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java index 8c5a4241dbe..e7737cc2e54 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java @@ -177,10 +177,15 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode // open the file from the breakpoints view it opens in the // proper editor. IProject project = b.getMarker().getResource().getProject(); - ICProject cproject = CoreModel.getDefault().create(project); - String id = CoreModel.getRegistedContentTypeId(project, path.lastSegment()); - ExternalTranslationUnit tu = new ExternalTranslationUnit(cproject, URIUtil.toURI(path), id); - return new ExternalEditorInput( tu ); + if (project != null) { + ICProject cproject = CoreModel.getDefault().create(project); + String id = CoreModel.getRegistedContentTypeId(project, path.lastSegment()); + ExternalTranslationUnit tu = new ExternalTranslationUnit(cproject, URIUtil.toURI(path), id); + return new ExternalEditorInput( tu ); + } + else { + return new ExternalEditorInput(path); + } } } }