1
0
Fork 0
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:
Alain Magloire 2002-11-18 15:51:12 +00:00
parent 413f2e0ca1
commit 8d3b4cda66

View file

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