Merge pull request #848 from runcom/panic-img

pkg: storage: fix panic when no image names
This commit is contained in:
Mrunal Patel 2017-09-06 17:31:34 -07:00 committed by GitHub
commit a81e90a9c9

View file

@ -99,6 +99,8 @@ func (svc *imageService) ListImages(systemContext *types.SystemContext, filter s
return nil, err
}
for _, image := range images {
var size *uint64
if len(image.Names) != 0 {
ref, err := svc.getRef(image.Names[0])
if err != nil {
return nil, err
@ -107,10 +109,12 @@ func (svc *imageService) ListImages(systemContext *types.SystemContext, filter s
if err != nil {
return nil, err
}
size = imageSize(img)
}
results = append(results, ImageResult{
ID: image.ID,
Names: image.Names,
Size: imageSize(img),
Size: size,
})
}
}