From 8f42cdc094968b125f685d4647217cc330b932b9 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 25 Oct 2025 01:18:30 -0500 Subject: catch some nil panics --- doPatch.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'doPatch.go') diff --git a/doPatch.go b/doPatch.go index 3a3a688..c7aeca9 100644 --- a/doPatch.go +++ b/doPatch.go @@ -66,7 +66,13 @@ func doPatch() (string, error) { } psets := forgepb.NewSets() - newpb, _, _ := psets.HttpPostVerbose(myServer(), "get") + newpb, _, err := psets.HttpPostVerbose(myServer(), "get") + if err != nil { + return "http post failed", err + } + if newpb == nil { + return "psets.HttpPost returned nil", err + } footer, err := doPatchGet(newpb) if footer == "" { log.Info(footer) @@ -323,6 +329,9 @@ func applyPatch(repo *gitpb.Repo, p *forgepb.Patch) (string, error) { func doPatchGet(newpb *forgepb.Sets) (string, error) { newpatches := forgepb.NewPatches() + if newpb == nil { + return "doPatchGet() newpb == nil", errors.New("doPatchGet() newpb == nil") + } for pset := range newpb.IterAll() { if pset.Patches.Len() == 0 { log.Info("pset is empty", pset.Name) -- cgit v1.2.3