Skip to content

Commit

Permalink
Merge pull request #1640 from jokemanfire/dev1
Browse files Browse the repository at this point in the history
Fix panic if Metadata is nil
  • Loading branch information
k8s-ci-robot authored Oct 16, 2024
2 parents 956e121 + 94a6e23 commit 8b53f41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/crictl/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ func getSandboxesList(sandboxesList []*pb.PodSandbox, opts *listOptions) []*pb.P
filtered := []*pb.PodSandbox{}
for _, p := range sandboxesList {
// Filter by pod name/namespace regular expressions.
if matchesRegex(opts.nameRegexp, p.Metadata.Name) &&
if p.Metadata != nil && matchesRegex(opts.nameRegexp, p.Metadata.Name) &&
matchesRegex(opts.podNamespaceRegexp, p.Metadata.Namespace) {
filtered = append(filtered, p)
}
Expand Down

0 comments on commit 8b53f41

Please sign in to comment.