Fix the nil pointer dereference for comformance spec validation

`verify-conformance-yaml.sh` is used to verify the test spec of
conformance e2e test are valid.

Bascically, it calls `e2e.test` binary to dump the test spec and
then walk the source to generate the `conformance.yaml`.

If the `e2e.test` binary is outdated, it's possible that `testInfo`
is nil.

Access the field from nil will result to `nil pointer dereference`

Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
Dave Chen 2022-04-02 16:29:40 +08:00
parent ba1bbb5ac6
commit 1b5d8b0b9b

View File

@ -108,10 +108,9 @@ func main() {
testInfo := getTestInfo(spec)
if testInfo != nil {
testInfos = append(testInfos, testInfo)
}
if err := validateTestName(testInfo.CodeName); err != nil {
log.Fatal(err)
if err := validateTestName(testInfo.CodeName); err != nil {
log.Fatal(err)
}
}
}
}