Don't crash in GetAccess if refs/meta/config is missing

Change-Id: I6ad1b9802d104d2dac4fc4d20f9478bfde5bccdf
This commit is contained in:
Han-Wen Nienhuys
2018-02-06 16:29:39 +01:00
parent 804082c5ae
commit c956776b92
2 changed files with 39 additions and 11 deletions

View File

@@ -156,12 +156,15 @@ public class GetAccess implements RestReadView<ProjectResource> {
config = ProjectConfig.read(md);
info.configWebLinks = new ArrayList<>();
// WebLinks operates in terms of the data types used in the GWT UI. Once the GWT UI is gone,
// WebLinks should be fixed to use the extension data types.
for (WebLinkInfoCommon wl :
webLinks.getFileHistoryLinks(
projectName.get(), config.getRevision().getName(), ProjectConfig.PROJECT_CONFIG)) {
info.configWebLinks.add(new WebLinkInfo(wl.name, wl.imageUrl, wl.url, wl.target));
// config may have a null revision if the repo doesn't have its own refs/meta/config.
if (config.getRevision() != null) {
// WebLinks operates in terms of the data types used in the GWT UI. Once the GWT UI is
// gone, WebLinks should be fixed to use the extension data types.
for (WebLinkInfoCommon wl :
webLinks.getFileHistoryLinks(
projectName.get(), config.getRevision().getName(), ProjectConfig.PROJECT_CONFIG)) {
info.configWebLinks.add(new WebLinkInfo(wl.name, wl.imageUrl, wl.url, wl.target));
}
}
if (config.updateGroupNames(groupBackend)) {