1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

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.

This commit is contained in:
John Cortell 2008-12-04 21:57:52 +00:00
parent f664db7f71
commit dbcc86e5c5

View file

@ -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);
}
}
}
}