Skip to content

Commit

Permalink
test: Check manifest.Platform before dereferencing
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
darfux committed Jul 22, 2019
1 parent f58fda9 commit 5e5ae23
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ func TestImagePullSomePlatforms(t *testing.T) {

found := false
for _, matcher := range m {
if manifest.Platform == nil {
t.Fatal("manifest should have proper platform")
}
if matcher.Match(*manifest.Platform) {
count++
found = true
Expand Down

0 comments on commit 5e5ae23

Please sign in to comment.