From d5287bc8a633b4930078db4a5816ef3b9af852a8 Mon Sep 17 00:00:00 2001 From: Jacek Wysocki Date: Thu, 3 Feb 2022 10:36:02 +0100 Subject: [PATCH] fix: added error handling for nils in fetch --- pkg/executor/content/fetcher.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/executor/content/fetcher.go b/pkg/executor/content/fetcher.go index 20e8f7c27a7..7db90ef6d18 100644 --- a/pkg/executor/content/fetcher.go +++ b/pkg/executor/content/fetcher.go @@ -21,6 +21,9 @@ type Fetcher struct { } func (f Fetcher) Fetch(content *testkube.ScriptContent) (path string, err error) { + if content == nil { + return "", fmt.Errorf("fetch - empty content, make sure script content has valid data structure and is not nil") + } switch testkube.ScriptContentType(content.Type_) { case testkube.ScriptContentTypeFileURI: return f.FetchURI(content.Uri)