Skip to content

Commit 672c193

Browse files
committed
Fixed 'index out of range' panic
1 parent caf00c4 commit 672c193

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pkg/cli/cmd_images.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ func runImages(cmd *Command, rawArgs []string) error {
6868
if imagesFilters != "" {
6969
for _, filter := range strings.Split(imagesFilters, " ") {
7070
parts := strings.SplitN(filter, "=", 2)
71+
if len(parts) != 2 {
72+
logrus.Warnf("Invalid filter '%s', should be in the form 'key=value'", filter)
73+
continue
74+
}
7175
if _, ok := args.Filters[parts[0]]; ok {
7276
logrus.Warnf("Duplicated filter: %q", parts[0])
7377
} else {

pkg/cli/cmd_ps.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ func runPs(cmd *Command, rawArgs []string) error {
7474
if psFilters != "" {
7575
for _, filter := range strings.Split(psFilters, " ") {
7676
parts := strings.SplitN(filter, "=", 2)
77+
if len(parts) != 2 {
78+
logrus.Warnf("Invalid filter '%s', should be in the form 'key=value'", filter)
79+
continue
80+
}
7781
if _, ok := args.Filters[parts[0]]; ok {
7882
logrus.Warnf("Duplicated filter: %q", parts[0])
7983
} else {

0 commit comments

Comments
 (0)