Skip to content

Commit

Permalink
fix nil pointer panic when evict
Browse files Browse the repository at this point in the history
Signed-off-by: Wenbo Zhang <[email protected]>
  • Loading branch information
Wenbo Zhang committed Apr 26, 2024
1 parent ffd0588 commit aee2a9e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/scheduler/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,14 @@ func (sc *SchedulerCache) Evict(taskInfo *schedulingapi.TaskInfo, reason string)
}()

podgroup := &vcv1beta1.PodGroup{}
if err := schedulingscheme.Scheme.Convert(&job.PodGroup.PodGroup, podgroup, nil); err != nil {

if job.PodGroup != nil {
err = schedulingscheme.Scheme.Convert(&job.PodGroup.PodGroup, podgroup, nil)
} else {
err = fmt.Errorf("the PodGroup of Job <%s/%s> is nil", job.Namespace, job.Name)
}

if err != nil {
klog.Errorf("Error while converting PodGroup to v1alpha1.PodGroup with error: %v", err)
return err
}
Expand Down

0 comments on commit aee2a9e

Please sign in to comment.