Skip to content

Commit c2f9c5c

Browse files
committed
Return not founf when project slice is empty
If implemented this will guard against index out of range errors. Signed-off-by: Soule BA <[email protected]>
1 parent 2e907fb commit c2f9c5c

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)