worker: check field exists before accessing it
Before accessing a field of the `OSBuildOutput`, which itself is a field of the `osbuildKojiResults` struct, check if it is actually is set (non-nill), otherwise dereferencing it will crash the worker. The field will be null if osbuild has not been invoked at all or if osbuild crashed or refused to accept the input.
This commit is contained in:
parent
46b2c2e31d
commit
da1537dee6
1 changed files with 3 additions and 1 deletions
|
|
@ -233,7 +233,9 @@ func hasFailedDependency(kojiInitResult worker.KojiInitJobResult, osbuildKojiRes
|
|||
}
|
||||
|
||||
for _, r := range osbuildKojiResults {
|
||||
if !r.OSBuildOutput.Success || r.JobError != nil {
|
||||
// No `OSBuildOutput` implies failure: either osbuild crashed or
|
||||
// rejected the input (manifest or command line arguments)
|
||||
if r.OSBuildOutput == nil || !r.OSBuildOutput.Success || r.JobError != nil {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue