mirror of
https://github.com/containers/podman.git
synced 2025-06-25 12:20:42 +08:00
Merge pull request #7448 from baude/issue7444
fix panic when checking len on nil object
This commit is contained in:
@ -1246,7 +1246,12 @@ func areParentAndChild(parent, child *imgspecv1.Image) bool {
|
|||||||
// the child and candidate parent should share all of the
|
// the child and candidate parent should share all of the
|
||||||
// candidate parent's diff IDs, which together would have
|
// candidate parent's diff IDs, which together would have
|
||||||
// controlled which layers were used
|
// controlled which layers were used
|
||||||
if len(parent.RootFS.DiffIDs) > len(child.RootFS.DiffIDs) {
|
|
||||||
|
// issue #7444 describes a panic where the length of child.RootFS.DiffIDs
|
||||||
|
// is checked but child is nil. Adding a simple band-aid approach to prevent
|
||||||
|
// the problem until the origin of the problem can be worked out in the issue
|
||||||
|
// itself.
|
||||||
|
if child == nil || len(parent.RootFS.DiffIDs) > len(child.RootFS.DiffIDs) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
childUsesCandidateDiffs := true
|
childUsesCandidateDiffs := true
|
||||||
|
Reference in New Issue
Block a user