mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +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")){
|
||||
// ensure that this .h file is part of a C project & not a CPP project
|
||||
|
||||
IProject project = getInputFile().getProject();
|
||||
c_file = !CoreModel.getDefault().hasCCNature(project);
|
||||
IFile file = getInputFile();
|
||||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue