From bb7542a437013348004b91eb0b7c8c2d99f83140 Mon Sep 17 00:00:00 2001 From: Christian Schulze Date: Sun, 5 Mar 2023 23:00:21 +0100 Subject: [PATCH] feat: fixed nil pointer dereference in case of existing config file --- src/action.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/action.go b/src/action.go index a471702..c0f3ebe 100644 --- a/src/action.go +++ b/src/action.go @@ -113,12 +113,14 @@ func (a *Action) Run() error { // build repo config configReader, err := a.GetConfigFile(repo.DefaultBranch) - if err != nil && err.Error() != "404 Not Found" { - return err - } else if err.Error() == "404 Not Found" { - // no config file found - githubactions.Warningf("No such config file: .gitea/%s", a.config.ConfigPath) - configReader = bytes.NewReader([]byte{}) + if err != nil { + if err.Error() != "404 Not Found" { + return err + } else { + // no config file found + githubactions.Warningf("No such config file: .gitea/%s", a.config.ConfigPath) + configReader = bytes.NewReader([]byte{}) + } } config, err := config.ReadRepoConfig(configReader, repo.DefaultBranch)