Commit b959d983 authored by Michael Schurter's avatar Michael Schurter
Browse files

add nil check around task resources in device hook

Looking at NewTaskRunner I'm unsure whether TaskRunner.TaskResources
(from which req.TaskResources is set) is intended to be nil at times or
if the TODO in NewTaskRunner is intended to ensure it is always non-nil.
parent c7b4ee15
No related merge requests found
Showing with 3 additions and 1 deletion
+3 -1
......@@ -30,7 +30,9 @@ func (*deviceHook) Name() string {
}
func (h *deviceHook) Prestart(ctx context.Context, req *interfaces.TaskPrestartRequest, resp *interfaces.TaskPrestartResponse) error {
if len(req.TaskResources.Devices) == 0 {
//TODO Can the nil check be removed once the TODO in NewTaskRunner
// where this is set is addressed?
if req.TaskResources == nil || len(req.TaskResources.Devices) == 0 {
resp.Done = true
return nil
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment