ChangeArgumentParser: Avoid NPE when project is not given
Also annotate the projectState arguments as @Nullable. Bug: Issue 10764 Change-Id: I978277db08071f34f673b30687c92ffabbf0608e
This commit is contained in:
parent
90569bd1fb
commit
f25692c1b5
@ -14,6 +14,7 @@
|
||||
|
||||
package com.google.gerrit.sshd;
|
||||
|
||||
import com.google.gerrit.common.Nullable;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.RestApiException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
@ -64,7 +65,7 @@ public class ChangeArgumentParser {
|
||||
}
|
||||
|
||||
public void addChange(
|
||||
String id, Map<Change.Id, ChangeResource> changes, ProjectState projectState)
|
||||
String id, Map<Change.Id, ChangeResource> changes, @Nullable ProjectState projectState)
|
||||
throws UnloggedFailure, OrmException, PermissionBackendException, IOException {
|
||||
addChange(id, changes, projectState, true);
|
||||
}
|
||||
@ -72,7 +73,7 @@ public class ChangeArgumentParser {
|
||||
public void addChange(
|
||||
String id,
|
||||
Map<Change.Id, ChangeResource> changes,
|
||||
ProjectState projectState,
|
||||
@Nullable ProjectState projectState,
|
||||
boolean useIndex)
|
||||
throws UnloggedFailure, OrmException, PermissionBackendException, IOException {
|
||||
List<ChangeNotes> matched = useIndex ? changeFinder.find(id) : changeFromNotesFactory(id);
|
||||
@ -92,7 +93,7 @@ public class ChangeArgumentParser {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!projectState.statePermitsRead()) {
|
||||
if (projectState != null && !projectState.statePermitsRead()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user