aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Ovcharenko2012-08-16 10:18:13 (EDT)
committerAleksey Ovcharenko2012-08-16 10:18:13 (EDT)
commit76c1f227fff3968c109e490cca0f5cf3d3b7f7c6 (patch)
tree3b921e745036911f2cbe777ab7ca8c373bf3665c
parent0bf0e4adeb9c5588d342df3348804fe69a5dace7 (diff)
downloadorg.eclipse.hudson.core-76c1f227fff3968c109e490cca0f5cf3d3b7f7c6.zip
org.eclipse.hudson.core-76c1f227fff3968c109e490cca0f5cf3d3b7f7c6.tar.gz
org.eclipse.hudson.core-76c1f227fff3968c109e490cca0f5cf3d3b7f7c6.tar.bz2
Fixed null pointer during job loading.refs/changes/56/7256/1
-rw-r--r--hudson-core/src/main/java/hudson/model/RunMap.java20
1 files changed, 11 insertions, 9 deletions
diff --git a/hudson-core/src/main/java/hudson/model/RunMap.java b/hudson-core/src/main/java/hudson/model/RunMap.java
index c9421c2..c03ba4f 100644
--- a/hudson-core/src/main/java/hudson/model/RunMap.java
+++ b/hudson-core/src/main/java/hudson/model/RunMap.java
@@ -8,11 +8,11 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- *
+ *
* Kohsuke Kawaguchi, Tom Huybrechts
*
*
- *******************************************************************************/
+ *******************************************************************************/
package hudson.model;
@@ -94,17 +94,19 @@ public final class RunMap<R extends Run<?, R>> extends AbstractMap<Integer, R> i
R r = m.put(key, value);
SortedMap<Integer, R> head = m.headMap(key);
if (!head.isEmpty()) {
- R prev = m.get(head.lastKey());
- value.previousBuild = prev.previousBuild;
- value.nextBuild = prev;
- if (value.previousBuild != null) {
- value.previousBuild.nextBuild = value;
+ if(m.containsKey(head.lastKey())) {
+ R prev = m.get(head.lastKey());
+ value.previousBuild = prev.previousBuild;
+ value.nextBuild = prev;
+ if (containsValue(value.previousBuild)) {
+ value.previousBuild.nextBuild = value;
+ }
+ prev.previousBuild = value;
}
- prev.previousBuild = value;
} else {
value.previousBuild = first;
value.nextBuild = null;
- if (first != null) {
+ if (containsValue(first)) {
first.nextBuild = value;
}
}