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,10 +211,12 @@ func (ei *edgeIndex) getAllMatches(k *CacheKey) []string {
for _, d := range dd { for _, d := range dd {
ll := CacheInfoLink{Input: Index(i), Digest: k.Digest(), Output: k.Output(), Selector: d.Selector} ll := CacheInfoLink{Input: Index(i), Digest: k.Digest(), Output: k.Output(), Selector: d.Selector}
for _, ckID := range d.CacheKey.CacheKey.indexIDs { for _, ckID := range d.CacheKey.CacheKey.indexIDs {
if l, ok := ei.items[ckID].links[ll]; ok { if item, ok := ei.items[ckID]; ok {
if _, ok := l[m]; ok { if l, ok := item.links[ll]; ok {
found = true if _, ok := l[m]; ok {
break found = true
break
}
} }
} }
} }