diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java index 6a87698d67..38070c0236 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/PostReview.java @@ -315,12 +315,16 @@ public class PostReview implements RestModifyView Iterator listItr = list.iterator(); while (listItr.hasNext()) { CommentInput c = listItr.next(); + if (c == null) { + listItr.remove(); + continue; + } if (c.line < 0) { throw new BadRequestException(String.format( "negative line number %d not allowed on %s", c.line, path)); } - c.message = Strings.emptyToNull(c.message).trim(); + c.message = Strings.nullToEmpty(c.message).trim(); if (c.message.isEmpty()) { listItr.remove(); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListChildProjects.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListChildProjects.java index 1910a5e44e..8d1e95f546 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ListChildProjects.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ListChildProjects.java @@ -26,6 +26,7 @@ import com.google.inject.Inject; import org.kohsuke.args4j.Option; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -96,7 +97,13 @@ public class ListChildProjects implements RestReadView { 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 getChildProjectsRecursively(ProjectNode p) {