List repos with starting prefix
Fix the NullPointException when a user visits "/test/" but only
"/test/project_a" and "/test/project_b" exist in Gerrit. It will
now list all projects starting with "test." This was implemented
already in Gitiles, but threw an NPE in this plugin before.
Change-Id: Ifeeca8c5eba81e9a3596d206648b7769a661a430
diff --git a/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java b/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java
index ece4591..01a777d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java
@@ -69,7 +69,7 @@
FilteredRepository create(Project.NameKey name)
throws NoSuchProjectException, IOException, PermissionBackendException {
ProjectState projectState = projectCache.checkedGet(name);
- if (!projectState.getProject().getState().permitsRead()) {
+ if (projectState == null || !projectState.getProject().getState().permitsRead()) {
throw new NoSuchProjectException(name);
}
return new FilteredRepository(