Merge "Fix NPE in /projects/{name}/children?recursive when a parent is missing" into stable-2.9

This commit is contained in:
David Pursehouse 2014-09-05 14:58:44 +00:00 committed by Gerrit Code Review
commit b8bb7c1109

View File

@ -25,6 +25,7 @@ import com.google.inject.Inject;
import org.kohsuke.args4j.Option;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -94,7 +95,13 @@ public class ListChildProjects implements RestReadView<ProjectResource> {
node.addChild(key);
}
}
return getChildProjectsRecursively(projects.get(parent));
ProjectNode n = projects.get(parent);
if (n != null) {
return getChildProjectsRecursively(n);
} else {
return Collections.emptyList();
}
}
private List<ProjectInfo> getChildProjectsRecursively(ProjectNode p) {