Avoid crash when --json doesn't request nameWithOwner

This commit is contained in:
Mislav Marohnić 2021-05-17 16:43:39 +02:00
parent a2307e357d
commit 3f3d4e38d4

View file

@ -158,7 +158,7 @@ pagination:
listResult.TotalCount = result.Search.RepositoryCount
for _, repo := range result.Search.Nodes {
if listResult.Owner == "" {
if listResult.Owner == "" && repo.NameWithOwner != "" {
idx := strings.IndexRune(repo.NameWithOwner, '/')
listResult.Owner = repo.NameWithOwner[:idx]
}