Skip to content

Commit

Permalink
Fixed 'index out of range' panic
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Aug 26, 2015
1 parent caf00c4 commit 672c193
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/cli/cmd_images.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ func runImages(cmd *Command, rawArgs []string) error {
if imagesFilters != "" {
for _, filter := range strings.Split(imagesFilters, " ") {
parts := strings.SplitN(filter, "=", 2)
if len(parts) != 2 {
logrus.Warnf("Invalid filter '%s', should be in the form 'key=value'", filter)
continue
}
if _, ok := args.Filters[parts[0]]; ok {
logrus.Warnf("Duplicated filter: %q", parts[0])
} else {
Expand Down
4 changes: 4 additions & 0 deletions pkg/cli/cmd_ps.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ func runPs(cmd *Command, rawArgs []string) error {
if psFilters != "" {
for _, filter := range strings.Split(psFilters, " ") {
parts := strings.SplitN(filter, "=", 2)
if len(parts) != 2 {
logrus.Warnf("Invalid filter '%s', should be in the form 'key=value'", filter)
continue
}
if _, ok := args.Filters[parts[0]]; ok {
logrus.Warnf("Duplicated filter: %q", parts[0])
} else {
Expand Down

0 comments on commit 672c193

Please sign in to comment.