diff --git a/models/actions/schedule_spec_list.go b/models/actions/schedule_spec_list.go index f7dac72f8b..4dc43f975b 100644 --- a/models/actions/schedule_spec_list.go +++ b/models/actions/schedule_spec_list.go @@ -22,6 +22,10 @@ func (specs SpecList) GetScheduleIDs() []int64 { } func (specs SpecList) LoadSchedules(ctx context.Context) error { + if len(specs) == 0 { + return nil + } + scheduleIDs := specs.GetScheduleIDs() schedules, err := GetSchedulesMapByIDs(ctx, scheduleIDs) if err != nil { @@ -50,6 +54,10 @@ func (specs SpecList) GetRepoIDs() []int64 { } func (specs SpecList) LoadRepos(ctx context.Context) error { + if len(specs) == 0 { + return nil + } + repoIDs := specs.GetRepoIDs() repos, err := repo_model.GetRepositoriesMapByIDs(ctx, repoIDs) if err != nil {