From 82967c63de311303b0e7441240429ea7e67570fa Mon Sep 17 00:00:00 2001 From: Victor Vrantchan Date: Mon, 1 Nov 2021 10:36:54 -0400 Subject: [PATCH] check for nil result to prevent crash The extension will crash on a host that doesn't have munki installed. --- tables/munki/munki.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tables/munki/munki.go b/tables/munki/munki.go index 06e8fde..c0c85a3 100644 --- a/tables/munki/munki.go +++ b/tables/munki/munki.go @@ -55,6 +55,10 @@ func MunkiInfoGenerate(ctx context.Context, queryContext table.QueryContext) ([] return nil, err } + if report == nil { // no files found + return nil, nil + } + errors := strings.Join(report.Errors, ";") warnings := strings.Join(report.Warnings, ";") problemInstalls := strings.Join(report.ProblemInstalls, ";") @@ -90,6 +94,9 @@ func MunkiInstallsGenerate(ctx context.Context, queryContext table.QueryContext) if err != nil { return nil, err } + if report == nil { + return nil, nil + } var results []map[string]string for _, install := range report.ManagedInstalls {