Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

fix null ip lookup error

Francis Caof569f6ac916c
diff --git a/lib/detect.js b/lib/detect.js
index d8294f050..e5bdd7335 100644
--- a/lib/detect.js
+++ b/lib/detect.js
@@ -79,10 +79,10 @@ export async function getClientInfo(req, { screen }) {
const userAgent = req.headers['user-agent'];
const ip = getIpAddress(req);
const location = await getLocation(ip);
- const country = location.country;
- const subdivision1 = location.subdivision1;
- const subdivision2 = location.subdivision2;
- const city = location.city;
+ const country = location?.country;
+ const subdivision1 = location?.subdivision1;
+ const subdivision2 = location?.subdivision2;
+ const city = location?.city;
const browser = browserName(userAgent);
const os = detectOS(userAgent);
const device = getDevice(screen, browser, os);