aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2021-03-01 21:27:53 -0600
committermat <27899617+mat-1@users.noreply.github.com>2021-03-01 21:27:53 -0600
commite505e9b9377e2c1ed9e366a3b288b0a5fd286458 (patch)
tree7267edca85bdc4dbb74949443a99adf6112567cf
parentbbdcf2665d1c76c903de12aa357877ca02df741f (diff)
downloadskyblock-api-e505e9b9377e2c1ed9e366a3b288b0a5fd286458.tar.gz
skyblock-api-e505e9b9377e2c1ed9e366a3b288b0a5fd286458.tar.bz2
skyblock-api-e505e9b9377e2c1ed9e366a3b288b0a5fd286458.zip
fix error for nonexistent players
-rw-r--r--build/hypixel.js5
-rw-r--r--src/hypixel.ts5
2 files changed, 6 insertions, 4 deletions
diff --git a/build/hypixel.js b/build/hypixel.js
index 1ea844a..9b307b5 100644
--- a/build/hypixel.js
+++ b/build/hypixel.js
@@ -81,8 +81,9 @@ async function fetchUser({ user, uuid, username }, included = ['player']) {
playerData = await cached.fetchPlayer(uuid);
// if not including profiles, include lightweight profiles just in case
if (!includeProfiles)
- basicProfilesData = playerData.profiles;
- playerData.profiles = undefined;
+ basicProfilesData = playerData === null || playerData === void 0 ? void 0 : playerData.profiles;
+ if (playerData)
+ playerData.profiles = undefined;
}
if (includeProfiles) {
profilesData = await cached.fetchSkyblockProfiles(uuid);
diff --git a/src/hypixel.ts b/src/hypixel.ts
index a5b8f93..b0bcf03 100644
--- a/src/hypixel.ts
+++ b/src/hypixel.ts
@@ -96,8 +96,9 @@ export async function fetchUser({ user, uuid, username }: UserAny, included: Inc
playerData = await cached.fetchPlayer(uuid)
// if not including profiles, include lightweight profiles just in case
if (!includeProfiles)
- basicProfilesData = playerData.profiles
- playerData.profiles = undefined
+ basicProfilesData = playerData?.profiles
+ if (playerData)
+ playerData.profiles = undefined
}
if (includeProfiles) {
profilesData = await cached.fetchSkyblockProfiles(uuid)