mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Automatic merge from release/2.0.0 -> release/2.1.0
* commit 'b5f4c472054d720858e12b9108455545fdae5749': 避免没有objs时数组访问越界
This commit is contained in:
@@ -216,6 +216,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