Commit abc8aa03 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Prevent statesAndStages from raising a panic

parent bcab5edc
Pipeline #7189567 passed with stages
in 26 minutes and 20 seconds
......@@ -150,10 +150,13 @@ func (b *buildsHelper) statesAndStages() map[common.BuildRuntimeState]map[common
data := make(map[common.BuildRuntimeState]map[common.BuildStage]int)
for _, build := range b.builds {
if data[build.CurrentState] == nil {
data[build.CurrentState] = make(map[common.BuildStage]int)
state := build.CurrentState
stage := build.CurrentStage
if data[state] == nil {
data[state] = make(map[common.BuildStage]int)
}
data[build.CurrentState][build.CurrentStage]++
data[state][stage]++
}
return data
}
......
......@@ -193,4 +193,4 @@ func TestBuildHelperCollectWhenRemovingBuild(t *testing.T) {
}
wg.Wait()
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment