Skip to content

Commit 9cf4444

Browse files
committed
Check that Placement is not null before trying to access it
Signed-off-by: Simone Giacomel <[email protected]>
1 parent ebe39a3 commit 9cf4444

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

manager/orchestrator/task.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ func nodeMatches(s *api.Service, n *api.Node) bool {
119119
return false
120120
}
121121

122+
if s.Spec.Task.Placement == nil {
123+
return false
124+
}
125+
122126
constraints, _ := constraint.Parse(s.Spec.Task.Placement.Constraints)
123127
return constraint.NodeMatches(constraints, n)
124128
}

0 commit comments

Comments
 (0)