summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-01 16:43:08 -0600
committerJeff Carr <[email protected]>2024-12-01 16:43:08 -0600
commit7a1c1e318045165f14894ce4a12e3105a68eb3cc (patch)
treeecd8e374eb6aa26dec8cad2a629a2bbcce19a242
parent2c8a813b714020681df1261af8937c1a106937f5 (diff)
kill nil panic possibilityv0.0.8
-rw-r--r--sort.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/sort.go b/sort.go
index f7f9ff9..1b8cd0e 100644
--- a/sort.go
+++ b/sort.go
@@ -319,6 +319,10 @@ func iterDeleteWithCopy(w io.Writer, names map[string]string) {
func iterFind(w io.Writer, names map[string]string) {
fmt.Fprintln(w, "// find a dependancy by the go path")
fmt.Fprintln(w, "func (all *"+names["Bases"]+") FindBy"+names["append"]+"(s string) *"+names["Base"]+" {")
+ fmt.Fprintln(w, " if all == nil {")
+ fmt.Fprintln(w, " return nil")
+ fmt.Fprintln(w, " }")
+ fmt.Fprintln(w, "")
if sortmap["lock"] == "all" {
fmt.Fprintln(w, " "+names["lock"]+".Lock.RLock()")
fmt.Fprintln(w, " defer "+names["lock"]+".Lock.RUnlock()")