Skip to content

Commit 5445839

Browse files
authored
Merge pull request #144 from fluxcd/fix-project-panic
[Stash] Return not found when project slice is empty
2 parents 2e907fb + c2f9c5c commit 5445839

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stash/projects.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ func (s *ProjectsService) Get(ctx context.Context, projectName string) (*Project
168168
return nil, fmt.Errorf("get project failed, unable to unmarshal repository list json: %w", err)
169169
}
170170

171+
if len(p.Projects) == 0 {
172+
return nil, ErrNotFound
173+
}
174+
171175
p.Projects[0].Session.set(resp)
172176
return p.Projects[0], nil
173177

0 commit comments

Comments
 (0)