提交 03214978 编写于 作者: O Oleg Nenashev 提交者: Oliver Gondža

Merge pull request #4348 from pilou-/handle_empty_views

[JENKINS-60092] getPrimaryView: return null if no view is defined

(cherry picked from commit 8bc435f3)
上级 cffb86a4
...@@ -163,12 +163,14 @@ public abstract class ViewGroupMixIn { ...@@ -163,12 +163,14 @@ public abstract class ViewGroupMixIn {
} }
/** /**
* Returns the primary {@link View} that renders the top-page of Hudson. * Returns the primary {@link View} that renders the top-page of Hudson or
* {@code null} if there is no primary one defined.
*/ */
@Exported @Exported
@CheckForNull
public View getPrimaryView() { public View getPrimaryView() {
View v = getView(primaryView()); View v = getView(primaryView());
if(v==null) // fallback if(v==null && !views().isEmpty()) // fallback
v = views().get(0); v = views().get(0);
return v; return v;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册