mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Prevent panic on update --container-label-add
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
4031d70d1b
commit
e462b4507a
1 changed files with 2 additions and 2 deletions
|
@ -253,7 +253,7 @@ func updatePlacement(flags *pflag.FlagSet, placement *swarm.Placement) {
|
|||
|
||||
func updateContainerLabels(flags *pflag.FlagSet, field *map[string]string) {
|
||||
if flags.Changed(flagContainerLabelAdd) {
|
||||
if field == nil {
|
||||
if *field == nil {
|
||||
*field = map[string]string{}
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ func updateContainerLabels(flags *pflag.FlagSet, field *map[string]string) {
|
|||
}
|
||||
}
|
||||
|
||||
if field != nil && flags.Changed(flagContainerLabelRemove) {
|
||||
if *field != nil && flags.Changed(flagContainerLabelRemove) {
|
||||
toRemove := flags.Lookup(flagContainerLabelRemove).Value.(*opts.ListOpts).GetAll()
|
||||
for _, label := range toRemove {
|
||||
delete(*field, label)
|
||||
|
|
Loading…
Add table
Reference in a new issue