diff --git a/client/task_runner.go b/client/task_runner.go index 26679803fb7..3d76da86026 100644 --- a/client/task_runner.go +++ b/client/task_runner.go @@ -146,7 +146,13 @@ func (r *TaskRunner) RestoreState() error { } // Restore fields - r.task = snap.Task + if snap.Task == nil { + err := fmt.Errorf("task runner snapshot include nil Task") + r.logger.Printf("[ERR] client: %v", err) + return err + } else { + r.task = snap.Task + } r.artifactsDownloaded = snap.ArtifactDownloaded if err := r.setTaskEnv(); err != nil {