null check in getSourceParser(IProject project, String natureId)
diff --git a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/parser/SourceParserManager.java b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/parser/SourceParserManager.java
index 7612fe9..18e9b3f 100644
--- a/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/parser/SourceParserManager.java
+++ b/core/plugins/org.eclipse.dltk.core/ast/org/eclipse/dltk/ast/parser/SourceParserManager.java
@@ -77,7 +77,12 @@
}
public ISourceParser getSourceParser(IProject project, String natureId) {
- return ((SourceParserContribution) getSelectedContribution(project, natureId)).getSourceParser();
+ SourceParserContribution contribution = (SourceParserContribution) getSelectedContribution(
+ project, natureId);
+ if (contribution != null) {
+ return contribution.getSourceParser();
+ }
+ return null;
}
static class SourceParserContribution extends DLTKContributedExtension {