From bc98cc6eaa3431f3d0c208fc41e2ad00d565f0dc Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Thu, 29 Feb 2024 13:00:07 +0300 Subject: [PATCH] fix minor metadata fetch issue --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index 499ca71..9f4e06a 100644 --- a/index.js +++ b/index.js @@ -77,6 +77,11 @@ async function fetchLevelData(name, creator, loose = false) { const { statusCode, headers, trailers, body } = await request(`https://history.geometrydash.eu/api/v1/search/level/advanced/?${params.toString()}`); const data = await body.json(); + if (!data.hits) { + console.warn('got fucked up response from gdhistory:', data); + return + } + if (data.hits.length === 0 && !loose) { return await fetchLevelData(name, creator, true); } else if (data.hits.length === 0) {