mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 08:55:25 +02:00
Catch possible risk of NPE
This commit is contained in:
parent
00f303ec04
commit
6a8c0ef458
1 changed files with 16 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue