scheduler: fix NPE when deployment is nil, but placement is a canary

This commit is contained in:
Nick Ethier
2019-01-24 23:57:07 -05:00
committed by Preetha Appan
parent 14c5a1c1f1
commit 80a04052b6

View File

@@ -517,7 +517,7 @@ func (s *GenericScheduler) computePlacements(destructive, place []placementResul
// If we are placing a canary and we found a match, add the canary
// to the deployment state object and mark it as a canary.
if missing.Canary() {
if missing.Canary() && s.deployment != nil {
if state, ok := s.deployment.TaskGroups[tg.Name]; ok {
state.PlacedCanaries = append(state.PlacedCanaries, alloc.ID)
}