Merge pull request from vvoland/c8d-history-fix-nil-deref

c8d/history: Fix nil dereference
This commit is contained in:
Sebastiaan van Stijn 2023-10-26 17:45:08 +02:00 committed by GitHub
commit 987f76ea78
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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...)