kill nil panic possibility

This commit is contained in:
Jeff Carr 2024-12-01 16:43:08 -06:00
parent 2c8a813b71
commit 7a1c1e3180
1 changed files with 4 additions and 0 deletions

View File

@ -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()")