From b3203b848a25b5aadebfe8fff3e0f01dda1919fa Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 30 Oct 2024 16:37:00 -0700 Subject: check for nil locations --- lib/locations.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/locations.ts b/lib/locations.ts index 74baf7e6..bb8b08cf 100644 --- a/lib/locations.ts +++ b/lib/locations.ts @@ -18,7 +18,7 @@ const dedup = (array) => export const getLocations = async () => { try { - const previous = await g("locations"); + const previous = await g("locations") || []; let since = await g("locations:since"); if (!since) since = "2022-09-19T00:00:00Z"; if (Date.now() - new Date(since).getTime() < 60000) return; @@ -56,6 +56,7 @@ export const getLocations = async () => { await s("locations", dedup(locations)); await s("locations:since", `${new Date().toISOString().split(".")[0]}Z`); } catch (e) { + console.log(e); err("problem fetching locations", e); } -- cgit v1.2.3