Merge pull request #848 from runcom/panic-img
pkg: storage: fix panic when no image names
This commit is contained in:
commit
a81e90a9c9
1 changed files with 12 additions and 8 deletions
|
@ -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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue