1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 16:55:38 +02:00

Protect against NPE.

This commit is contained in:
Sergey Prigogin 2012-09-02 19:21:02 -07:00
parent 9e9c380798
commit 435b10dfdf

View file

@ -398,10 +398,17 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
return array == null ? CharArrayUtils.EMPTY_CHAR_ARRAY : array;
}
/**
* Returns include search path for a given current directory and a IScannerInfo.
* @param directory the current directory
* @param info scanner information, or {@code null} if not available
* @return the include search path
*/
public static IncludeSearchPath configureIncludeSearchPath(File directory, IScannerInfo info) {
boolean inhibitUseOfCurrentFileDirectory= false;
List<IncludeSearchPathElement> elements = new ArrayList<IncludeSearchPathElement>();
if (info != null) {
// Quote includes first
if (info instanceof IExtendedScannerInfo) {
final IExtendedScannerInfo einfo= (IExtendedScannerInfo) info;
@ -427,6 +434,7 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
}
}
}
}
return new IncludeSearchPath(elements, inhibitUseOfCurrentFileDirectory);
}