Skip to content

Commit 6e5e943

Browse files
committed
fix: prevent panic in nydus snapshotter inspect
Signed-off-by: Ruihua Wen <[email protected]>
1 parent 300a705 commit 6e5e943

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/inspecttypes/dockercompat/dockercompat.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,9 @@ func ImageFromNative(nativeImage *native.Image) (*Image, error) {
340340

341341
if len(imgOCI.History) > 0 {
342342
image.Comment = imgOCI.History[len(imgOCI.History)-1].Comment
343-
image.Created = imgOCI.History[len(imgOCI.History)-1].Created.Format(time.RFC3339Nano)
343+
if !imgOCI.History[len(imgOCI.History)-1].Created.IsZero() {
344+
image.Created = imgOCI.History[len(imgOCI.History)-1].Created.Format(time.RFC3339Nano)
345+
}
344346
image.Author = imgOCI.History[len(imgOCI.History)-1].Author
345347
}
346348

0 commit comments

Comments
 (0)