aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2011-11-22 07:50:41 (EST)
committerJohn Ross2011-11-22 07:50:41 (EST)
commitf25b89f5879c9ee436272dee42a0a8951faaa519 (patch)
treeb657f6a244c2b95397a865f88f7ea57f6418633f
parent049ac4efd0bb6efd55ffd3fa4c862288dca95cfe (diff)
downloadrt.equinox.bundles-f25b89f5879c9ee436272dee42a0a8951faaa519.zip
rt.equinox.bundles-f25b89f5879c9ee436272dee42a0a8951faaa519.tar.gz
rt.equinox.bundles-f25b89f5879c9ee436272dee42a0a8951faaa519.tar.bz2
Bug 364459: Check for null icon list when no icons were specified.
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/ObjectClassDefinitionImpl.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/ObjectClassDefinitionImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/ObjectClassDefinitionImpl.java
index 82d13f8..5741127 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/ObjectClassDefinitionImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/ObjectClassDefinitionImpl.java
@@ -166,6 +166,9 @@ public class ObjectClassDefinitionImpl extends LocalizationElement implements Eq
@SuppressWarnings("hiding")
// Use a local reference to the icon list to be sure we don't suddenly start using a new one.
List<Icon> icons = this.icons;
+ // Icons will be null if none were specified.
+ if (icons == null)
+ return null;
int index = Collections.binarySearch(icons, icon, iconComparator);
if (index < 0) {
// If the index is less than zero, there wasn't an exact match.
@@ -203,6 +206,9 @@ public class ObjectClassDefinitionImpl extends LocalizationElement implements Eq
}
synchronized void setIcons(List<Icon> icons) {
+ // Do nothing if icons is null or empty.
+ if (icons == null || icons.isEmpty())
+ return;
// Prepare the list of icons for binary searches as in getIcon(int).
Collections.sort(icons, iconComparator);
// Make the list unmodifiable for safe binary searches without copying.