Skip to content

Commit 4c11386

Browse files
author
Preetha
authored
Merge pull request #5259 from hashicorp/b-npe-scheduler
scheduler: fix NPE when deployment is nil, but placement is a canary
2 parents 14c5a1c + 80a0405 commit 4c11386

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

scheduler/generic_sched.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ func (s *GenericScheduler) computePlacements(destructive, place []placementResul
517517

518518
// If we are placing a canary and we found a match, add the canary
519519
// to the deployment state object and mark it as a canary.
520-
if missing.Canary() {
520+
if missing.Canary() && s.deployment != nil {
521521
if state, ok := s.deployment.TaskGroups[tg.Name]; ok {
522522
state.PlacedCanaries = append(state.PlacedCanaries, alloc.ID)
523523
}

0 commit comments

Comments
 (0)