mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +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:
parent
f664db7f71
commit
dbcc86e5c5
1 changed files with 9 additions and 4 deletions
|
@ -177,11 +177,16 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
|
||||||
// open the file from the breakpoints view it opens in the
|
// open the file from the breakpoints view it opens in the
|
||||||
// proper editor.
|
// proper editor.
|
||||||
IProject project = b.getMarker().getResource().getProject();
|
IProject project = b.getMarker().getResource().getProject();
|
||||||
|
if (project != null) {
|
||||||
ICProject cproject = CoreModel.getDefault().create(project);
|
ICProject cproject = CoreModel.getDefault().create(project);
|
||||||
String id = CoreModel.getRegistedContentTypeId(project, path.lastSegment());
|
String id = CoreModel.getRegistedContentTypeId(project, path.lastSegment());
|
||||||
ExternalTranslationUnit tu = new ExternalTranslationUnit(cproject, URIUtil.toURI(path), id);
|
ExternalTranslationUnit tu = new ExternalTranslationUnit(cproject, URIUtil.toURI(path), id);
|
||||||
return new ExternalEditorInput( tu );
|
return new ExternalEditorInput( tu );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
return new ExternalEditorInput(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue