fixed potential out of bounds

This commit is contained in:
2022-08-13 22:03:16 +02:00
parent 8ff928d7fa
commit b48c75a177
2 changed files with 38 additions and 35 deletions

View File

@@ -329,9 +329,10 @@ func (b *BuildManager) refreshSRCINFOs(ctx context.Context, path string) error {
cur := 0
wg := sync.WaitGroup{}
for i := 0; i < runtime.NumCPU(); i++ {
if cur+step > len(pkgBuilds) {
step -= cur + step - len(pkgBuilds)
if i == runtime.NumCPU()-1 {
step = len(pkgBuilds) - cur
}
wg.Add(1)
go func(pkgBuilds []string) {
defer wg.Done()