From 18f4f61f0af62edd095da7b87533972e3f2b35fa Mon Sep 17 00:00:00 2001 From: pg9182 <96569817+pg9182@users.noreply.github.com> Date: Sun, 5 Mar 2023 20:58:26 -0500 Subject: pkg/api/api0: Fix crash in geo metrics when IP2Location is disabled --- pkg/api/api0/api.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'pkg') diff --git a/pkg/api/api0/api.go b/pkg/api/api0/api.go index afce1d4..79766e5 100644 --- a/pkg/api/api0/api.go +++ b/pkg/api/api0/api.go @@ -228,6 +228,10 @@ func (h *Handler) ExtractLauncherVersion(r *http.Request) string { // geoCounter2 increments a [metricsx.GeoCounter2] for the location of r. func (h *Handler) geoCounter2(r *http.Request, ctr *metricsx.GeoCounter2) { + if h.LookupIP == nil { + return + } + a, err := netip.ParseAddrPort(r.RemoteAddr) if err != nil { return -- cgit v1.2.3