diff options
author | mat <github@matdoes.dev> | 2021-06-30 01:15:19 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-06-30 01:15:19 -0500 |
commit | 03991ab4890202dcfd5415da66773638245dccf1 (patch) | |
tree | 663e8fe2e9f3e4fbf3298970565261baebbe02d6 /build/cleaners/skyblock | |
parent | 568c74568c1397ea0db329b205e6ff6fd80eabd4 (diff) | |
download | skyblock-api-03991ab4890202dcfd5415da66773638245dccf1.tar.gz skyblock-api-03991ab4890202dcfd5415da66773638245dccf1.tar.bz2 skyblock-api-03991ab4890202dcfd5415da66773638245dccf1.zip |
fix error that happens sometimes for nonexistent players
Diffstat (limited to 'build/cleaners/skyblock')
-rw-r--r-- | build/cleaners/skyblock/profile.js | 2 | ||||
-rw-r--r-- | build/cleaners/skyblock/profiles.js | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/build/cleaners/skyblock/profile.js b/build/cleaners/skyblock/profile.js index da988cc..6460c3b 100644 --- a/build/cleaners/skyblock/profile.js +++ b/build/cleaners/skyblock/profile.js @@ -48,6 +48,8 @@ exports.cleanSkyblockProfileResponseLighter = cleanSkyblockProfileResponseLighte async function cleanSkyblockProfileResponse(data, options) { // We use Promise.all so it can fetch all the users at once instead of waiting for the previous promise to complete const promises = []; + if (!data) + return null; for (const memberUUID in data.members) { const memberRaw = data.members[memberUUID]; memberRaw.uuid = memberUUID; diff --git a/build/cleaners/skyblock/profiles.js b/build/cleaners/skyblock/profiles.js index ba84303..b916209 100644 --- a/build/cleaners/skyblock/profiles.js +++ b/build/cleaners/skyblock/profiles.js @@ -20,7 +20,7 @@ async function cleanSkyblockProfilesResponse(data) { // let cleanedProfile = await cleanSkyblockProfileResponseLighter(profile) promises.push(profile_1.cleanSkyblockProfileResponse(profile)); } - const cleanedProfiles = await Promise.all(promises); + const cleanedProfiles = (await Promise.all(promises)).filter(p => p); return cleanedProfiles; } exports.cleanSkyblockProfilesResponse = cleanSkyblockProfilesResponse; |