1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Fix for 179170: NPE when opening C/C++ Projects view

This commit is contained in:
Anton Leherbauer 2007-03-26 14:07:02 +00:00
parent 9e498979be
commit 86e275f960
2 changed files with 10 additions and 8 deletions

View file

@ -1030,20 +1030,19 @@ public class CCorePlugin extends Plugin {
// }
/**
* Helper function, returning the contenttype for a filename
* Same as: <p><p>
* Helper function, returning the content type for a filename
* Same as: <pre>
* getContentType(null, filename)
* <br>
* @param project
* @param name
* @return
* </pre>
* @param filename
* @return the content type found, or <code>null</code>
*/
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 <code>null</code>

View file

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