all repos — searchix @ 2c1491de56d0c3e2f4cb0b0c1e33035510f72fc5

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

fix: check for nil pointers in NewMux
Alan Pearce alan@alanpearce.eu
Fri, 24 May 2024 18:24:50 +0200
commit

2c1491de56d0c3e2f4cb0b0c1e33035510f72fc5

parent

042dadb9ee2c8ea32a8cda063732c0d0be62cec6

1 files changed, 6 insertions(+), 0 deletions(-)

jump to
M internal/server/mux.gointernal/server/mux.go
@@ -83,6 +83,12 @@ index *search.ReadIndex, 	liveReload bool,
 ) (*http.ServeMux, error) {
 	var err error
+	if cfg == nil {
+		return nil, errors.New("cfg is nil")
+	}
+	if index == nil {
+		return nil, errors.New("index is nil")
+	}
 	sentryHandler := sentryhttp.New(sentryhttp.Options{
 		Repanic: true,
 	})