summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-25 05:31:18 (EST)
committer Winston Prakash2011-12-01 20:47:37 (EST)
commit41b1e17985ecfd3b4d68c0cce4afa8c15f14a35b (patch)
treeaa590aa67ab5da330233fb1e2007a0ff2da1aa78
parent0fa5a23a18c315ec415276a5410de2fd7f226c29 (diff)
downloadorg.eclipse.hudson.core-41b1e17985ecfd3b4d68c0cce4afa8c15f14a35b.zip
org.eclipse.hudson.core-41b1e17985ecfd3b4d68c0cce4afa8c15f14a35b.tar.gz
org.eclipse.hudson.core-41b1e17985ecfd3b4d68c0cce4afa8c15f14a35b.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;
}