solver: fix possible nil dereference

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
docker-18.09
Tonis Tiigi 2018-10-08 21:49:20 -07:00
parent ab6a2dc83e
commit 14b1afa3d0
1 changed files with 6 additions and 4 deletions

View File

@ -211,7 +211,8 @@ 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 item, ok := ei.items[ckID]; ok {
if l, ok := item.links[ll]; ok {
if _, ok := l[m]; ok {
found = true
break
@ -219,6 +220,7 @@ func (ei *edgeIndex) getAllMatches(k *CacheKey) []string {
}
}
}
}
if !found {
delete(matches, m)