summaryrefslogtreecommitdiff
diff options
authorPawel Stolowski <stolowski@gmail.com>2018-04-04 10:58:54 +0200
committerPawel Stolowski <stolowski@gmail.com>2018-04-04 10:58:54 +0200
commit6c9cc005d46ebdaffd0d72cf03ae0e2b67c5b27c (patch)
tree065f4ec6d976a0172a90b1125bd6e802cc33f162
parent98a948313409169580bf6aa22cdb9c6dc5abc334 (diff)
Review feedback.inject-tasks
-rw-r--r--overlord/ifacestate/handlers.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/overlord/ifacestate/handlers.go b/overlord/ifacestate/handlers.go
index 7f3ccfff6a..12985afb76 100644
--- a/overlord/ifacestate/handlers.go
+++ b/overlord/ifacestate/handlers.go
@@ -771,18 +771,19 @@ func injectTasks(mainTask *state.Task, extraTasks *state.TaskSet) {
if len(lanes) == 1 && lanes[0] == 0 {
lanes = nil
}
- ht := mainTask.HaltTasks()
-
for _, l := range lanes {
extraTasks.JoinLane(l)
}
chg := mainTask.Change()
+ // Change shouldn't normally be nil, except for cases where
+ // this helper is used before tasks are added to a change.
if chg != nil {
chg.AddAll(extraTasks)
}
// make all halt tasks of the mainTask wait on extraTasks
+ ht := mainTask.HaltTasks()
for _, t := range ht {
t.WaitAll(extraTasks)
}