mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Automatic merge from release/2.2.0 -> release/2.3.0
* commit 'e015b4cbd03e9f4cdb50ed793fb55791619eb2d9': 避免没有objs时数组访问越界
This commit is contained in:
@@ -227,6 +227,10 @@ func (manager *STaskManager) NewParallelTask(ctx context.Context, taskName strin
|
||||
return nil, fmt.Errorf("task %s not found", taskName)
|
||||
}
|
||||
|
||||
if len(objs) == 0 {
|
||||
return nil, fmt.Errorf("failed to do task %s with zero objs", taskName)
|
||||
}
|
||||
|
||||
log.Debugf("number of objs: %d", len(objs))
|
||||
lockman.LockClass(ctx, objs[0].GetModelManager(), userCred.GetProjectId())
|
||||
defer lockman.ReleaseClass(ctx, objs[0].GetModelManager(), userCred.GetProjectId())
|
||||
|
||||
Reference in New Issue
Block a user