diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java index 940d9e4e1af..be865101187 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CCorePlugin.java @@ -1030,20 +1030,19 @@ public class CCorePlugin extends Plugin { // } /** - * Helper function, returning the contenttype for a filename - * Same as:
+ * Helper function, returning the content type for a filename + * Same as:
* getContentType(null, filename) - *+ * @param filename + * @return the content type found, or
- * @param project - * @param name - * @return + *
null
*/
public static IContentType getContentType(String filename) {
return CContentTypes.getContentType(null, filename);
}
/**
- * Returns the content type for a filename. The method respects project
+ * Returns the content type for a filename. The method respects
* project specific content type definitions. The lookup prefers case-
* sensitive matches over the others.
* @param project a project with possible project specific settings. Can be null
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CContentTypes.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CContentTypes.java
index f20d65e37f3..9ffe97e40a8 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CContentTypes.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/CContentTypes.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 Wind River Systems, Inc. and others.
+ * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -39,6 +39,9 @@ public class CContentTypes {
* Implementation for {@link CCorePlugin#getContentType(IProject, String)}.
*/
public static IContentType getContentType(IProject project, String filename) {
+ if (filename == null) {
+ return null;
+ }
IContentTypeMatcher matcher= null;
IScopeContext scopeCtx= null;
boolean preferCpp= true;