提交 5b70aeb4 编写于 作者: K kohsuke

fixed an NPE regression I introduced while modifying the patch.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@20900 71c3de6d-444a-0410-be80-ed276b4c234a
上级 9f08582e
......@@ -1958,7 +1958,7 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
* @see hudson.tasks.LabelFinder
*/
public Set<Label> getDynamicLabels() {
if (dynamicLabels.isChanged(toComputer()))
if (dynamicLabels==null || dynamicLabels.isChanged(toComputer()))
// in the worst cast, two threads end up doing the same computation
// twice, but that won't break the semantics.
// OTOH, not locking prevents dead-lock. See #1390
......
......@@ -244,7 +244,7 @@ public abstract class Slave extends Node implements Serializable {
// so a care needs to be taken to avoid race conditions under all
// circumstances.
synchronized (this) {
if (dynamicLabels.isChanged(toComputer()))
if (dynamicLabels==null || dynamicLabels.isChanged(toComputer()))
dynamicLabels = new DynamicLabels(toComputer());
}
return dynamicLabels.labels;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册