From 14b1afa3d0a84aced5b07855d3bf7620e13e0701 Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Mon, 8 Oct 2018 21:49:20 -0700 Subject: [PATCH] solver: fix possible nil dereference Signed-off-by: Tonis Tiigi --- solver/index.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/solver/index.go b/solver/index.go index 1bb17d89..78a2cca2 100644 --- a/solver/index.go +++ b/solver/index.go @@ -211,10 +211,12 @@ func (ei *edgeIndex) getAllMatches(k *CacheKey) []string { for _, d := range dd { ll := CacheInfoLink{Input: Index(i), Digest: k.Digest(), Output: k.Output(), Selector: d.Selector} for _, ckID := range d.CacheKey.CacheKey.indexIDs { - if l, ok := ei.items[ckID].links[ll]; ok { - if _, ok := l[m]; ok { - found = true - break + if item, ok := ei.items[ckID]; ok { + if l, ok := item.links[ll]; ok { + if _, ok := l[m]; ok { + found = true + break + } } } }