From be5c5db01f6ba53784367c17f2ce09009209fdee Mon Sep 17 00:00:00 2001 From: Philipp Mieden Date: Tue, 2 Jun 2020 12:14:27 +0200 Subject: [PATCH] prevent a nil pointer exception if the status API is called but the config hasn't been initialized yet --- status.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/status.go b/status.go index cdaef90..1450ae7 100644 --- a/status.go +++ b/status.go @@ -24,6 +24,12 @@ func Status() *CertStatus { var certData []byte if !local { + // prevent a nil pointer exception if the status API is called + // but the config hasn't been initialized yet + if c == nil { + return nil + } + // read cert resource from disk b, err := ioutil.ReadFile(filepath.Join(c.CacheDir, certResourceFileName)) if err != nil {