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:
parent
9e498979be
commit
86e275f960
2 changed files with 10 additions and 8 deletions
|
@ -1030,20 +1030,19 @@ public class CCorePlugin extends Plugin {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function, returning the contenttype for a filename
|
* Helper function, returning the content type for a filename
|
||||||
* Same as: <p><p>
|
* Same as: <pre>
|
||||||
* getContentType(null, filename)
|
* getContentType(null, filename)
|
||||||
* <br>
|
* </pre>
|
||||||
* @param project
|
* @param filename
|
||||||
* @param name
|
* @return the content type found, or <code>null</code>
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static IContentType getContentType(String filename) {
|
public static IContentType getContentType(String filename) {
|
||||||
return CContentTypes.getContentType(null, 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-
|
* project specific content type definitions. The lookup prefers case-
|
||||||
* sensitive matches over the others.
|
* sensitive matches over the others.
|
||||||
* @param project a project with possible project specific settings. Can be <code>null</code>
|
* @param project a project with possible project specific settings. Can be <code>null</code>
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -39,6 +39,9 @@ public class CContentTypes {
|
||||||
* Implementation for {@link CCorePlugin#getContentType(IProject, String)}.
|
* Implementation for {@link CCorePlugin#getContentType(IProject, String)}.
|
||||||
*/
|
*/
|
||||||
public static IContentType getContentType(IProject project, String filename) {
|
public static IContentType getContentType(IProject project, String filename) {
|
||||||
|
if (filename == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
IContentTypeMatcher matcher= null;
|
IContentTypeMatcher matcher= null;
|
||||||
IScopeContext scopeCtx= null;
|
IScopeContext scopeCtx= null;
|
||||||
boolean preferCpp= true;
|
boolean preferCpp= true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue