Skip to content

Commit 975f72b

Browse files
jonahgrahamiloveeclipse
authored andcommitted
Add potentially missing null checks
This fixes a potential regression introduced in 34b8e38 When that commit was done some instanceof checks were removed. The result of removing the instanceof checks had the side effect of removing the implicit null check that instanceof essentially does. This change restores the null checks for all the instanceofs that were removed in 34b8e38
1 parent ceb2335 commit 975f72b

File tree

2 files changed

+16
-11
lines changed
  • apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/util
  • ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target

2 files changed

+16
-11
lines changed

apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/util/Signatures.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -584,15 +584,18 @@ public static String getTypeSignature(Type type, boolean erased) {
584584
}
585585
if (typeParameters != null) {
586586
for (TypeParameter typeParameter : typeParameters) {
587-
if (fullyQualifiedName.equals(typeParameter.getName().getFullyQualifiedName())) {
588-
if (typeParameter.typeBounds().isEmpty()) {
589-
yield Signature.createTypeSignature("Object", false); //$NON-NLS-1$
590-
} else {
591-
// the erasure of a type
592-
// variable is the erasure of
593-
// its leftmost bound
594-
Type bound = (Type) typeParameter.typeBounds().get(0);
595-
yield getTypeSignature(bound, erased);
587+
if (typeParameter != null) {
588+
if (fullyQualifiedName
589+
.equals(typeParameter.getName().getFullyQualifiedName())) {
590+
if (typeParameter.typeBounds().isEmpty()) {
591+
yield Signature.createTypeSignature("Object", false); //$NON-NLS-1$
592+
} else {
593+
// the erasure of a type
594+
// variable is the erasure of
595+
// its leftmost bound
596+
Type bound = (Type) typeParameter.typeBounds().get(0);
597+
yield getTypeSignature(bound, erased);
598+
}
596599
}
597600
}
598601
}

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/P2TargetUtils.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,8 +1554,10 @@ private void findProfileRepos(Set<URI> additionalRepos) {
15541554
Collection<IRepositoryReference> repos = new org.eclipse.equinox.internal.p2.engine.ProfileMetadataRepository(
15551555
getGlobalAgent(), dataArea, null).getReferences();
15561556
for (IRepositoryReference reference : repos) {
1557-
if (reference.getType() == IRepository.TYPE_ARTIFACT && reference.getLocation() != null) {
1558-
additionalRepos.add(reference.getLocation());
1557+
if (reference != null) {
1558+
if (reference.getType() == IRepository.TYPE_ARTIFACT && reference.getLocation() != null) {
1559+
additionalRepos.add(reference.getLocation());
1560+
}
15591561
}
15601562
}
15611563
} catch (CoreException e) {

0 commit comments

Comments
 (0)