test: Check manifest.Platform before dereferencing
If the registry returns a manifest without platform info, the `manifest.Platform` will be `nil` and cause panic when dereferencing. Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
This commit is contained in:
parent
f58fda97ec
commit
5e5ae23d80
@ -293,6 +293,9 @@ func TestImagePullSomePlatforms(t *testing.T) {
|
|||||||
|
|
||||||
found := false
|
found := false
|
||||||
for _, matcher := range m {
|
for _, matcher := range m {
|
||||||
|
if manifest.Platform == nil {
|
||||||
|
t.Fatal("manifest should have proper platform")
|
||||||
|
}
|
||||||
if matcher.Match(*manifest.Platform) {
|
if matcher.Match(*manifest.Platform) {
|
||||||
count++
|
count++
|
||||||
found = true
|
found = true
|
||||||
|
Loading…
Reference in New Issue
Block a user