Merge pull request #2657 from crazy-max/fix-nil

fix nil pointer dereference in bridge result
master
Tõnis Tiigi 2022-02-18 16:45:26 -08:00 committed by GitHub
commit a1cfefeaeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -165,15 +165,15 @@ func (b *llbBridge) Solve(ctx context.Context, req frontend.SolveRequest, sid st
if len(res.Refs) > 0 {
for p := range res.Refs {
dtbi, errm := buildinfo.GetMetadata(res.Metadata, fmt.Sprintf("%s/%s", exptypes.ExporterBuildInfo, p), req.Frontend, req.FrontendOpt)
if errm != nil {
dtbi, err := buildinfo.GetMetadata(res.Metadata, fmt.Sprintf("%s/%s", exptypes.ExporterBuildInfo, p), req.Frontend, req.FrontendOpt)
if err != nil {
return nil, err
}
res.Metadata[fmt.Sprintf("%s/%s", exptypes.ExporterBuildInfo, p)] = dtbi
}
} else {
dtbi, errm := buildinfo.GetMetadata(res.Metadata, exptypes.ExporterBuildInfo, req.Frontend, req.FrontendOpt)
if errm != nil {
dtbi, err := buildinfo.GetMetadata(res.Metadata, exptypes.ExporterBuildInfo, req.Frontend, req.FrontendOpt)
if err != nil {
return nil, err
}
res.Metadata[exptypes.ExporterBuildInfo] = dtbi