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

Check for NPE

This commit is contained in:
Alain Magloire 2004-04-30 02:44:04 +00:00
parent 69a8947522
commit 1fefb24038

View file

@ -126,8 +126,12 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
} }
// get path and ensure it is absolute // get path and ensure it is absolute
//String pathAttr = element.getAttribute(ATTRIBUTE_PATH); IPath path;
IPath path = new Path(element.getAttribute(ATTRIBUTE_PATH)); if (element.hasAttribute(ATTRIBUTE_PATH)) {
path = new Path(element.getAttribute(ATTRIBUTE_PATH));
} else {
path = new Path(""); //$NON-NLS-1$
}
if (!path.isAbsolute()) { if (!path.isAbsolute()) {
path = projectPath.append(path); path = projectPath.append(path);
} }
@ -165,7 +169,7 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
case IPathEntry.CDT_PROJECT : case IPathEntry.CDT_PROJECT :
return CoreModel.newProjectEntry(path, isExported); return CoreModel.newProjectEntry(path, isExported);
case IPathEntry.CDT_LIBRARY : case IPathEntry.CDT_LIBRARY :
if (!baseRef.isEmpty()) { if (baseRef != null && !baseRef.isEmpty()) {
return CoreModel.newLibraryRefEntry(baseRef, path); return CoreModel.newLibraryRefEntry(baseRef, path);
} }
return CoreModel.newLibraryEntry(basePath, path, sourceAttachmentPath, sourceAttachmentRootPath, return CoreModel.newLibraryEntry(basePath, path, sourceAttachmentPath, sourceAttachmentRootPath,
@ -195,7 +199,7 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
if (element.hasAttribute(ATTRIBUTE_SYSTEM)) { if (element.hasAttribute(ATTRIBUTE_SYSTEM)) {
isSystemInclude = element.getAttribute(ATTRIBUTE_SYSTEM).equals(VALUE_TRUE); isSystemInclude = element.getAttribute(ATTRIBUTE_SYSTEM).equals(VALUE_TRUE);
} }
if (!baseRef.isEmpty()) { if (baseRef != null && !baseRef.isEmpty()) {
return CoreModel.newIncludeRefEntry(path, baseRef, includePath); return CoreModel.newIncludeRefEntry(path, baseRef, includePath);
} }
return CoreModel.newIncludeEntry(path, basePath, includePath, isSystemInclude, exclusionPatterns, isExported); return CoreModel.newIncludeEntry(path, basePath, includePath, isSystemInclude, exclusionPatterns, isExported);
@ -204,7 +208,7 @@ public class PathEntryStore extends AbstractCExtension implements IPathEntryStor
{ {
String macroName = element.getAttribute(ATTRIBUTE_NAME); String macroName = element.getAttribute(ATTRIBUTE_NAME);
String macroValue = element.getAttribute(ATTRIBUTE_VALUE); String macroValue = element.getAttribute(ATTRIBUTE_VALUE);
if (!baseRef.isEmpty()) { if (baseRef != null && !baseRef.isEmpty()) {
return CoreModel.newMacroRefEntry(path, baseRef, macroName); return CoreModel.newMacroRefEntry(path, baseRef, macroName);
} }
return CoreModel.newMacroEntry(path, macroName, macroValue, exclusionPatterns, isExported); return CoreModel.newMacroEntry(path, macroName, macroValue, exclusionPatterns, isExported);