diff options
author | pg9182 <96569817+pg9182@users.noreply.github.com> | 2023-03-05 20:58:26 -0500 |
---|---|---|
committer | pg9182 <96569817+pg9182@users.noreply.github.com> | 2023-03-05 20:58:26 -0500 |
commit | 18f4f61f0af62edd095da7b87533972e3f2b35fa (patch) | |
tree | 21935375b6d6a3391f5d73cdde5eb5dbfc1b3430 /pkg | |
parent | 75c48fbf0ccbf1e7a01350a7fa6855f86a574d38 (diff) | |
download | Atlas-18f4f61f0af62edd095da7b87533972e3f2b35fa.tar.gz Atlas-18f4f61f0af62edd095da7b87533972e3f2b35fa.zip |
pkg/api/api0: Fix crash in geo metrics when IP2Location is disabled
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/api0/api.go | 4 |
1 files changed, 4 insertions, 0 deletions
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 |