File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -234,8 +234,8 @@ func (c *imageCache) put(image *types.ImageInfo) {
234234 c .idToDigests [id ][repoDigests [0 ]] = true
235235 }
236236
237- c .refToID [repoDigests [0 ]] = id
238237 }
238+ c .refToID [repoDigests [0 ]] = id
239239
240240 // get repoTags and repoDigest from idToTags and idToDigests
241241 if item := c .ids .Get (patricia .Prefix (id )); item != nil {
@@ -270,7 +270,11 @@ func (c *imageCache) get(idOrRef string) (*types.ImageInfo, error) {
270270
271271 var id string
272272 if refDigest , ok := refNamed .(reference.Digested ); ok {
273- id = c .refToID [refDigest .String ()]
273+ var exists bool
274+ id , exists = c .refToID [refDigest .String ()]
275+ if ! exists {
276+ return nil , errors .Wrap (errtypes .ErrNotfound , "image: " + idOrRef )
277+ }
274278 } else {
275279 refTagged := reference .WithDefaultTagIfMissing (refNamed ).(reference.Tagged )
276280 if len (c .refToID [refTagged .String ()]) == 0 {
@@ -289,7 +293,6 @@ func (c *imageCache) get(idOrRef string) (*types.ImageInfo, error) {
289293 }
290294 return nil
291295 }
292-
293296 if err := c .ids .VisitSubtree (patricia .Prefix (id ), fn ); err != nil {
294297 // the error does not occur.
295298 return nil , err
You can’t perform that action at this time.
0 commit comments