未验证 提交 a4352d57 编写于 作者: O Oleg Nenashev 提交者: GitHub

Merge pull request #4247 from jglick/nullability

Improved null handling in AbstractProject.<init>
......@@ -260,9 +260,8 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
buildMixIn = createBuildMixIn();
builds = buildMixIn.getRunMap();
final Jenkins j = Jenkins.get();
final List<Node> nodes = j != null ? j.getNodes() : null;
if(nodes!=null && !nodes.isEmpty()) {
Jenkins j = Jenkins.getInstanceOrNull();
if (j != null && !j.getNodes().isEmpty()) {
// if a new job is configured with Hudson that already has agent nodes
// make it roamable by default
canRoam = true;
......
......@@ -2096,6 +2096,7 @@ public class Jenkins extends AbstractCIBase implements DirectlyModifiableTopLeve
* Returns all {@link Node}s in the system, excluding {@link Jenkins} instance itself which
* represents the master.
*/
@Nonnull
public List<Node> getNodes() {
return nodes.getNodes();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册