Skip to content

Commit f32077f

Browse files
committed
[core] Fix crash in task.Manager.configureTasks
1 parent dbeed29 commit f32077f

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

core/task/manager.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,18 @@ func (m *Manager) configureTasks(envId uid.ID, tasks Tasks) error {
516516
return err
517517
}
518518

519+
if tasks == nil || len(tasks) == 0 {
520+
return fmt.Errorf("empty task list to configure for environment %s", envId.String())
521+
}
522+
519523
// We fetch each task's local bindMap to generate a global bindMap for the whole Tasks slice,
520524
// i.e. a map of the paths of registered inbound channels and their ports.
521525
bindMap := make(channel.BindMap)
522526
for _, task := range tasks {
523-
taskPath := task.GetParent().GetPath()
527+
if task.GetParent() == nil { // Crash reported here by Roberto 6/2022
528+
return fmt.Errorf("task %s on %s has nil parent, this should never happen", task.GetClassName(), task.GetHostname())
529+
}
530+
taskPath := task.GetParentRolePath()
524531
for inbChName, endpoint := range task.GetLocalBindMap() {
525532
var bindMapKey string
526533
if strings.HasPrefix(inbChName, "::") { //global channel alias

0 commit comments

Comments
 (0)