From 8fbee67f45ead62d3cf796189c700eeae99aef98 Mon Sep 17 00:00:00 2001 From: fujiwara Date: Fri, 26 Jan 2024 14:51:18 +0900 Subject: [PATCH] fix segfault when creating a new function. --- init.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init.go b/init.go index e412f58..922fe61 100644 --- a/init.go +++ b/init.go @@ -72,7 +72,11 @@ func (app *App) Init(ctx context.Context, opt *InitOption) error { tags = res.Tags } - fn := newFunctionFrom(c, res.Code, tags) + var code *types.FunctionCodeLocation + if res != nil { + code = res.Code + } + fn := newFunctionFrom(c, code, tags) if opt.DownloadZip && res.Code != nil && *res.Code.RepositoryType == "S3" { log.Printf("[info] downloading %s", FunctionZipFilename)