fix: nil deref when custom builder image (#1273)

Signed-off-by: Matej Vasek <mvasek@redhat.com>

Signed-off-by: Matej Vasek <mvasek@redhat.com>
This commit is contained in:
Matej Vasek 2022-09-22 15:00:12 +02:00 committed by GitHub
parent 44ff20d782
commit 2988f0c06b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -153,6 +153,8 @@ func NewFunctionWith(defaults Function) Function {
// selectively consider the minimal validation necesssary to ehable migration.
func NewFunction(path string) (f Function, err error) {
f.Root = path // path is not persisted, as this is the purvew of the FS itself
f.BuilderImages = make(map[string]string)
f.Annotations = make(map[string]string)
var filename = filepath.Join(path, FunctionFile)
if _, err = os.Stat(filename); err != nil {
return