From 779efbce6ad81851dc874f5418ca3195f902699b Mon Sep 17 00:00:00 2001 From: Samuel Karp Date: Fri, 9 Jun 2017 11:20:52 -0700 Subject: [PATCH] containerd: nil-check before calling io.Close Signed-off-by: Samuel Karp --- task.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/task.go b/task.go index 7d776a16d..d710b7e81 100644 --- a/task.go +++ b/task.go @@ -156,7 +156,10 @@ func (t *task) Wait(ctx context.Context) (uint32, error) { // it returns the exit status of the task and any errors that were encountered // during cleanup func (t *task) Delete(ctx context.Context) (uint32, error) { - cerr := t.io.Close() + var cerr error + if t.io != nil { + cerr = t.io.Close() + } r, err := t.client.TaskService().Delete(ctx, &execution.DeleteRequest{ ContainerID: t.containerID, })