Skip to content

Commit

Permalink
fix: error handling for wildcard mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jpts committed May 6, 2023
1 parent 905200c commit 3daffb6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/wildcard.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func wildcard(opts *cliOpts) ([]*svcResult, error) {
return nil, err
}

if len(res.additional) == 0 {
if res == nil || res.additional == nil {
log.Debug().Msgf("No svcs for proto %s found", proto)
continue
}
Expand All @@ -37,7 +37,7 @@ func wildcard(opts *cliOpts) ([]*svcResult, error) {
svcs, _ = addUniqueSvcToSvcs(svcs, svc)
}

if len(res.answers) == 0 {
if res.answers == nil {
log.Debug().Msgf("No named ports for %s svcs found", proto)
continue
}
Expand All @@ -58,7 +58,7 @@ func wildcard(opts *cliOpts) ([]*svcResult, error) {
continue
}

if len(res.answers) == 0 {
if res == nil || res.answers == nil {
log.Debug().Msgf("svc %s/%s has no registered endpoints", svc.Namespace, svc.Name)
continue
}
Expand Down

0 comments on commit 3daffb6

Please sign in to comment.