all repos — searchix @ a34ba86c2c899bbf2902c4c99b817a9692c3294f

Search engine for NixOS, nix-darwin, home-manager and NUR users

fix: handle missing manpage URL map without aborting

Alan Pearce
commit

a34ba86c2c899bbf2902c4c99b817a9692c3294f

parent

e763b363b499b8e90d0c80d8b658b64ad3a12b6c

1 file changed, 5 insertions(+), 1 deletion(-)

changed files
M internal/manpages/manpages.gointernal/manpages/manpages.go
@@ -33,6 +33,7 @@ func New(opts *Options) *URLMap {
return &URLMap{ logger: opts.Logger, root: opts.Root, + urlMap: make(map[string]string), } }
@@ -75,6 +76,10 @@ if err != nil {
return fault.Wrap(err, fmsg.Withf("failed to stat manpages file: %s", basename)) } + if stat == nil { + return nil + } + data, err := m.root.ReadFile(basename) if err != nil { return fault.Wrap(err, fmsg.With("failed to read manpages file"))
@@ -82,7 +87,6 @@ }
m.mtime = stat.ModTime() - m.urlMap = make(map[string]string) if err := json.Unmarshal(data, &m.urlMap); err != nil { return fault.Wrap(err, fmsg.With("failed to parse manpages JSON")) }