mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
CEditor input may be IStorage fix not to NPE.
This commit is contained in:
parent
413f2e0ca1
commit
8d3b4cda66
1 changed files with 5 additions and 2 deletions
|
@ -1417,8 +1417,11 @@ public class CEditor extends AbstractTextEditor implements ISelectionChangedList
|
||||||
if (!c_file && filename.endsWith(".h")){
|
if (!c_file && filename.endsWith(".h")){
|
||||||
// ensure that this .h file is part of a C project & not a CPP project
|
// ensure that this .h file is part of a C project & not a CPP project
|
||||||
|
|
||||||
IProject project = getInputFile().getProject();
|
IFile file = getInputFile();
|
||||||
c_file = !CoreModel.getDefault().hasCCNature(project);
|
if (file != null) {
|
||||||
|
IProject project = file.getProject();
|
||||||
|
c_file = !CoreModel.getDefault().hasCCNature(project);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new AdaptedSourceViewer(parent, ruler, styles, c_file ? LANGUAGE_C : LANGUAGE_CPP);
|
return new AdaptedSourceViewer(parent, ruler, styles, c_file ? LANGUAGE_C : LANGUAGE_CPP);
|
||||||
|
|
Loading…
Add table
Reference in a new issue