Merge pull request #673 from tonistiigi/nil-value-check

solver: fix possible nil dereference
docker-18.09
Tõnis Tiigi 2018-10-08 23:34:01 -07:00 committed by GitHub
commit 8c8792b234
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)