Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlain Magloire2002-12-19 20:50:14 +0000
committerAlain Magloire2002-12-19 20:50:14 +0000
commit6a8c0ef458fe38739e1e9c196377e5efeadb3268 (patch)
treed08c76e702659ff51d8767fb14ec567321830cde
parent00f303ec0459b2e94421de6250456866d709d5c2 (diff)
downloadorg.eclipse.cdt-6a8c0ef458fe38739e1e9c196377e5efeadb3268.tar.gz
org.eclipse.cdt-6a8c0ef458fe38739e1e9c196377e5efeadb3268.tar.xz
org.eclipse.cdt-6a8c0ef458fe38739e1e9c196377e5efeadb3268.zip
Catch possible risk of NPE
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/BinaryContainerAdapter.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/BinaryContainerAdapter.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/BinaryContainerAdapter.java
index 4d20d8f36bd..a322d9f32f6 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/BinaryContainerAdapter.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/parser/BinaryContainerAdapter.java
@@ -137,11 +137,14 @@ public class BinaryContainerAdapter extends Container implements IFolder {
if (f == null) {
// Pass it to parent to create a fake/phantom if the object
// is not in the archive.
- f = getParent().getFile(path);
- // Add it to the list of phantoms
- if (! phantomResources.contains(f)) {
- phantomResources.add(f);
- phantomResources.trimToSize();
+ IContainer container = getParent();
+ if (container != null) {
+ f = container.getFile(path);
+ // Add it to the list of phantoms
+ if (! phantomResources.contains(f)) {
+ phantomResources.add(f);
+ phantomResources.trimToSize();
+ }
}
}
return f;
@@ -176,10 +179,14 @@ public class BinaryContainerAdapter extends Container implements IFolder {
public IFolder getFolder(IPath path) {
// Only Files in the archive pass this to the parent
// to create a phatom resource
- IFolder f = getParent().getFolder(path);
- if (!phantomResources.contains(f)) {
- phantomResources.add(f);
- phantomResources.trimToSize();
+ IFolder f = null;
+ IContainer container = getParent();
+ if (container != null) {
+ f = container.getFolder(path);
+ if (!phantomResources.contains(f)) {
+ phantomResources.add(f);
+ phantomResources.trimToSize();
+ }
}
return f;
}

Back to the top