c8d/history: Fix nil dereference
Check if `Created` is not nil before dereferencing. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
parent
1b9411ef77
commit
27e064e7e9
1 changed files with 5 additions and 1 deletions
|
@ -81,11 +81,15 @@ func (i *ImageService) ImageHistory(ctx context.Context, name string) ([]*imaget
|
|||
sizes = sizes[1:]
|
||||
}
|
||||
|
||||
var created int64
|
||||
if h.Created != nil {
|
||||
created = h.Created.Unix()
|
||||
}
|
||||
history = append([]*imagetype.HistoryResponseItem{{
|
||||
ID: "<missing>",
|
||||
Comment: h.Comment,
|
||||
CreatedBy: h.CreatedBy,
|
||||
Created: h.Created.Unix(),
|
||||
Created: created,
|
||||
Size: size,
|
||||
Tags: nil,
|
||||
}}, history...)
|
||||
|
|
Loading…
Add table
Reference in a new issue