aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-25 05:31:18 (EST)
committerWinston Prakash2011-12-01 20:47:37 (EST)
commita77aa78e5b772f1eaf61742467dcc587e15db804 (patch)
tree522179096b45f91fc320b498563c4f65ae592f7b
parentae3c340c79de8b2450dc25c77888188dc1581fa2 (diff)
downloadorg.eclipse.hudson.core-a77aa78e5b772f1eaf61742467dcc587e15db804.zip
org.eclipse.hudson.core-a77aa78e5b772f1eaf61742467dcc587e15db804.tar.gz
org.eclipse.hudson.core-a77aa78e5b772f1eaf61742467dcc587e15db804.tar.bz2
Add null check for Describable#toMap method. Avoid NPE and possible fix for HUDSON-9067
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/Descriptor.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/hudson-core/src/main/java/hudson/model/Descriptor.java b/hudson-core/src/main/java/hudson/model/Descriptor.java
index 02d9c35..2816564 100644
--- a/hudson-core/src/main/java/hudson/model/Descriptor.java
+++ b/hudson-core/src/main/java/hudson/model/Descriptor.java
@@ -760,8 +760,10 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
public static <T extends Describable<T>>
Map<Descriptor<T>,T> toMap(Iterable<T> describables) {
Map<Descriptor<T>,T> m = new LinkedHashMap<Descriptor<T>,T>();
- for (T d : describables) {
- m.put(d.getDescriptor(),d);
+ if (null != describables) {
+ for (T d : describables) {
+ m.put(d.getDescriptor(), d);
+ }
}
return m;
}