Skip to content

Commit

Permalink
Merge pull request #853 from burmanm/fix_nil_pointer_in_ns
Browse files Browse the repository at this point in the history
Verify the length of contexts in namespace cmd
  • Loading branch information
sunny0826 authored Jan 15, 2024
2 parents 9e39ef7 + 61d5f77 commit 786b5ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func (nc *NamespaceCommand) runNamespace(command *cobra.Command, args []string)
if err != nil {
return err
}
if len(config.Contexts) == 0 {
return fmt.Errorf("no valid context found")
}

currentContext := config.CurrentContext
contNs := config.Contexts[currentContext].Namespace
namespaceList, err := GetNamespaceList(contNs)
Expand Down

0 comments on commit 786b5ef

Please sign in to comment.